簡體   English   中英

Instagram實時子訂閱發送空POST請求

[英]Instagram realtime subsrciption sends empty POST requests

我有一個問題,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);
?>

在空查詢的活動constist中:

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 

我試圖向你的回調網址發送一個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以添加尾部斜杠。

所以你的回調網址應該是http://xxxx/realtime/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM