php - Curling Instagrams API -
i trying curl url https://www.instagram.com/<handle>/media/ profiles data json. how come when hit url in browser correct response when try curl using php follows:
$url = "https://www.instagram.com/<handle>/media/"; $curl_connection = curl_init($url); curl_setopt($curl_connection, curlopt_connecttimeout, 30); curl_setopt($curl_connection, curlopt_returntransfer, true); curl_setopt($curl_connection, curlopt_ssl_verifypeer, true); $json = curl_exec($curl_connection); curl_close($curl_connection); echo $json; i response:
{"status":"ok","items":[],"more_available":false} however not useful , not same when hit url in browser.
this leads me believe not curling correctly.
any suggestions?
follow up:
i tried file_get_contents($url); seems give users data correctly account not. there reason this?
i'd suggest using file_get_contents instead:
file_get_contents("https://www.instagram.com/derek/media/"); worked me!
hope helps :-)
Comments
Post a Comment