1

我有一个问题,Instagram 向我发送了实时订阅的空数据。这是我的步骤

我正在注册订阅

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 回答我

{
    "meta": {
        "code": 200
    },
    "data": {
        "object": "tag",
        "object_id": "newyork",
        "aspect": "media",
        "callback_url": "http://myurl/realtime",
        "type": "subscription",
        "id": "2838731"
    }
}

没关系。

比我尝试使用此脚本接受 instagram 请求:

<?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)."\r\n";
file_put_contents('activity.log', $ALL, FILE_APPEND);
?>

在活动中由空查询组成:

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 
4

1 回答 1

4

我尝试向您的回调 URL 发送 POST 请求,这是我得到的:

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>

我认为 Instagram 不支持 301 重定向。因此,您可能必须更改回调 URL 以添加尾部斜杠。

所以你的回调 URL 应该是http://x.x.x.x/realtime/

于 2013-01-28T13:48:09.853 回答