Instagram APIに接続しようとしていますが、接続は正常に機能し、APIドキュメントに記載されているとおりに更新を受信しています。問題は、コールバック関数に送信されたデータにアクセスできないことです。
ドキュメントによると
誰かが新しい写真を投稿し、それがサブスクリプションの1つの更新をトリガーすると、サブスクリプションで定義したコールバックURLに対してPOSTリクエストが行われます。
これは私のコードです:
// check if we have a security challenge
if (isset ($_GET['hub_challenge']))
            echo $_GET['hub_challenge'];  
    else // This is an update
    {
        // read  the content of $_POST
        $myString = file_get_contents('php://input');
        $answer = json_decode($myString);
        // This is not working  starting from here
        $id = $answer->{'object_id'};
        $api = 'https://api.instagram.com/v1/locations/'.$id.'/media/recent?client_secret='.INSTA_CLI_SECRET.'&client_id='.INSTA_CLI_ID;
        $response = get_curl($api); //change request path to pull different photos
        $images = array();
        if($response){
        $decode = json_decode($response);
        foreach($decode->{'data'} as $item){
             // do something with the data here
             }
        }
    }
$ myString変数を表示すると、この結果が得られます。なぜjsonにデコードされないのかわかりません:(
[{"changed_aspect": "media"、 "subscription_id":2468174、 "object": "geography"、 "object_id": "1518250"、 "time":1350044500}]
$ idをハードコーディングすると、get_curl関数は正常に機能します。
$ myStringに何か問題があると思いますが、残念ながら$ _POST cvariableが入力されていません。何が欠けているのでしょうか?