Skip navigation.
Home

iPhone Sales Script

scott's picture

This is the script I developed to download my daily sales numbers from iTunes Connect. I got tired of logging into the server every day to see how sales were so I wrote the script and stuck it in a cron job to run every morning. The standard output of the script is trapped by cron and sent as an email. You can also just run this on the command line in Terminal.

To use this script you need to do the following:

  1. Make sure the path to perl is correct on the first line. I set it to the default MacOS X location here. If you have a custom version like I do, just point to the correct one.
    #!/usr/bin/perl
  2. Change the username and password placeholder text to your iTunesConnect login info.
    my $username = 'insert_your_iTunesConnect_user_name_here';
    my $password = 'insert_your_iTunesConnect_password_here';

  3. Make sure you have the latest version of the Crypt::SSLeay module.
    perl -MCrypt::SSLeay -le "print(Crypt::SSLeay->VERSION)"
    Which should return a version number of at least: 0.57
  4. Make sure you have the latest version of the LWP::UserAgent module.
    perl -MLWP::UserAgent -le "print(LWP::UserAgent->VERSION)"
    Which should return a version number of at least: 5.824

The latest version of MacOS X as of this writing is 10.5.6 (10.5.7 is almost out) and it does not ship with the Crypt::SSLeay module for perl. If you have no idea what I'm talking about, read on as you will want to install this module before you try to run this script.

If you have not installed the perl module Crypt::SSLeay you will see an error message when you try to run this script that it requires a certain version of the module. The latest as of this writing is version 0.57. To see what version you have installed you can use the perl command below at the command line prompt:

perl -MCrypt::SSLeay -le "print(Crypt::SSLeay->VERSION)"

If you have the correct one installed it will return the string "0.57", otherwise it will return nothing. If you don't have the module you will need to install it with CPAN. Below are the commands you type into a terminal window to install the latest Crypt and LWP.

sudo cpan
install Bundle::LWP
install Crypt::SSLeay
quit

You can then rerun the previous perl command above to see that it is now installed as the version number will be returned.

If you have any questions about the script, leave me a comment or email me through the Contact link.

AttachmentSize
get-sales.pl2.74 KB
scott's picture

apple changed the website

I'm not sure if anyone is even using this script other than me. If you are, leave me a comment and I'll update the script for the latest changes Apple made to iTunesConnect that broke it. I've already patched my copy to get it up and running again but I can make some serious changes to make it more resilient to Apple's future changes. But not really worth it if nobody is using it.