Note that there are some explanatory texts on larger screens.

plurals
  1. POInstagram Real time API - PHP - Unable to get POST Update
    primarykey
    data
    text
    <p>I'm trying to connect with the instagram API, the connection works fine and I am receiving the updates just as described in the API documentation, the issue is that I cannot access to the data send to my callback function.</p> <p>According to the <a href="http://instagram.com/developer/realtime/" rel="nofollow">doc</a></p> <blockquote> <p>When someone posts a new photo and it triggers an update of one of your subscriptions, we make a POST request to the callback URL that you defined in the subscription</p> </blockquote> <p>This is my code :</p> <pre><code>// 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-&gt;{'object_id'}; $api = 'https://api.instagram.com/v1/locations/'.$id.'/media/recent?client_secret='.INSTA_CLI_SECRET.'&amp;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-&gt;{'data'} as $item){ // do something with the data here } } } </code></pre> <p>Displaying the $myString variable I have this result, don't know why it is not decoded to json :(</p> <blockquote> <p>[{"changed_aspect": "media", "subscription_id": 2468174, "object": "geography", "object_id": "1518250", "time": 1350044500}]</p> </blockquote> <p>the get_curl function is working fine when I hardcode my $id.</p> <p>I guess something is wrong with my $myString, unfortunately the $_POST cvariable is not populated, Any idea what I am missing ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload