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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -