I upload all of my logs to QRZ.com. I’m a subscriber, and I like the site, but I do it mostly for fun. QRZ.com offers no method for logging programs to interact with it for logbook uploads, so I set out to hack something up that works, because I hate doing things manually. Here’s what I came up with.
I wrote a shell script in Linux that runs every minute and looks for an ADIF file by a certain name. When it finds a file named qrz.adi, it uploads automatically via command line using CURL to the qrz.com website. Here’s the script:
if [ -f $ADIF ]; then
curl -s -b $COOKIE -F “op=upfile” -F “book=$BOOK” -F upload_file=”@$ADIF” http://qrz.com/logbook -o $OUTPUT
grep “successfully” $OUTPUT
mv $ADIF $ARCHIVE/qrz_$DATE.adi
echo “Nothing to do”
In order to make this work, you must first login to qrz.com using curl and get a session cookie. Here’s the code to make that work:
curl -c cookies.txt –data ‘username=your_qrz_login&password=your_qrz_pass’ http://qrz.com/logbook
This will place a file called cookies.txt in the present worked directory containing session information to authenticate your account. The cookies.txt file is then referenced by curl in the upload script; the same as any other web browser. To schedule the uploads, add the script to cron. If no file is found to upload, the script simply exits.
cbbyers@wormhole:~/ham/logs$ crontab -l | grep upload_qrz
* * * * * /home/cbbyers/ham/logs/upload_qrz.sh > /home/cbbyers/ham/logs/cron.log 2>&1
Since my logging program is on Windows, and I do my scripting on Linux, I am using Samba to copy the ADIF file into the watched directory. I still must manually export an ADIF file from Log4OM and place it in the Samba share, but I am also looking for a way to automate that piece. Here’s what the output of the uploader looks like:
Your logfile, qrz.adi was uploaded successfully. We received 4659 bytes.
The text in green is HTML output from QRZ.com – the same text you see if you upload manually via Chrome or Firefox. This is a very basic script that needs some error checking and additional work. I spent hours in Wireshark analyzing an HTTP upload performed in Chrome so that I could translate it to curl properly. I hope you find this useful.