Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram API. "Unable to reach callback url"

Ok guys so here is the setup. I am developing a site for a festival and need to use the Instragram API. The client would like to automatically load pictures from Instagram that use a certain hashtag. No problem here, the instagram API supports this function and many more.

But when I try to make a subscription (via a cURL Post Operation) I get an error response that my callback-url is unreachable. But it is reachable. I can surf to it via the browser no problem.

My cURL operation looks like this:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$result = curl_exec($ch);       
curl_close($ch);    

and this is the response I get after executing the post operation above:

{"meta":{"error_type":"APISubscriptionError","code":400,"error_message":"Unable to reach callback URL \"...myUrl...\"."}}

Any instagram guru's online that know what I'm doing wrong?

Note: I've tried to subscribe in both my callback-url file/api aswell as in an apart php file.

like image 234
JeremyS Avatar asked Nov 13 '22 08:11

JeremyS


1 Answers

If you're using your home computer to develop it make sure the callback url you provided to instagram's servers can be reached (from their side)

You may have a firewall on your computer (make sure you allow incoming connections)
Or try running your code on a remote server (if you're not already)

like image 55
Tarang Avatar answered Nov 16 '22 04:11

Tarang