I have a problem that Instagram send me empty data on real time subscription. Here is my steps
I am registering subscription
root@132701-10002:/var/www/realtime# curl -F 'client_id=MYSECRET' -F 'client_secret= MYSECRET' -F 'object=tag' -F 'aspect=media' -F 'object_id=newyork' -F 'callback_url=http://myurl/realtime' https://api.instagram.com/v1/subscriptions/
instagram answers me
{
"meta": {
"code": 200
},
"data": {
"object": "tag",
"object_id": "newyork",
"aspect": "media",
"callback_url": "http://myurl/realtime",
"type": "subscription",
"id": "2838731"
}
}
Its ok.
Than I am trying to accept instagram requests using this script:
<?php
if (@$_GET["hub_challenge"])
{
echo $_GET["hub_challenge"];
}
$myString = file_get_contents('php://input');
$answer = json_decode($myString);
$ALL = date("F j, Y, g:i a")." ".print_r($answer,true)."
";
file_put_contents('activity.log', $ALL, FILE_APPEND);
?>
in activity constist from empty queries:
January 28, 2013, 12:09 pm
January 28, 2013, 12:09 pm
January 28, 2013, 12:09 pm
January 28, 2013, 12:09 pm
January 28, 2013, 12:09 pm
January 28, 2013, 12:09 pm
January 28, 2013, 12:09 pm
January 28, 2013, 12:10 pm
January 28, 2013, 12:10 pm
January 28, 2013, 12:10 pm
January 28, 2013, 12:10 pm
January 28, 2013, 12:10 pm
January 28, 2013, 12:10 pm
January 28, 2013, 12:10 pm
I tried to send a POST request to your callback URL, here is what I got:
curl -X POST x.x.x.x/realtime
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://x.x.x.x/realtime/">here</a>.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at x.x.x.x Port 80</address>
</body></html>
I think Instagram does not support 301 redirects. So you may have to change your callback URL to add the trailing slash.
So your callback URL should be http://x.x.x.x/realtime/