Add curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

Add ssl-code as described at http://www.karlmonaghan.com/2011/09/18/a-sunday-afternoon-project-providing-app-store-stats-via-json/#comment-171
I am pretty sure that is the right place to put it … but please check.