javascript - instagram subscription tag steps on Real-time Photo Updates -
i'm new in instagram, base on real-time photo updates. don't understand process, can enlighten me how create callback url in php? register client's redirect uri need link callback url? below code how did callback url
$checkin_url = "https://api.instagram.com/v1/subscriptions/"; //$instagram[] client_id, client_secret, redirect_uri $parameters = array( 'client_id' => $instagram['client_id'], 'client_secret' => $instagram['client_secret'], 'object' => 'tag', 'aspect' => 'media', 'object_id' => 'nofilter', 'callback_url' => $instagram['redirect_uri'] ); $curl = curl_init($checkin_url); curl_setopt($curl, curlopt_post, true); curl_setopt($curl, curlopt_postfields, $parameters); curl_setopt($curl, curlopt_returntransfer, 1); $response = curl_exec($curl); print($response);
you missed important step in subscription process (it's in doc):
when post info above create new subscription, simultaneously submit request callback url [...] in order verify subscription, server must respond request hub.challenge parameter only:
in other word, when create subscription, send request callback uri parameters, , have return hub.challenge parameters (hub_challenge in php, because php parameters . converted _).
so in callback uri, have test request method. if it's get, following :
exit($_get['hub_challenge']); and if it's post, it's subscription update, have json decode raw body datas, stated in doc' :)
Comments
Post a Comment