I'm working with old Instagram API. It works fast if I use cUrl, but I have to use sockets or file_get_contents() - then it takes 10+ seconds to response.
I have tried sending various headers like 'Connection: close' and using http 1.0/1.1 - but nothing helped.
Here code samples:
cUrl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.instagram.com/v1/users/self/?access_token=some_token");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$res = curl_exec($ch);
curl_close($ch);
print_r($res);
file_get_contents()
$res = file_get_contents("https://api.instagram.com/v1/users/self/?access_token=some_token");
print_r($res);