GET request working in test but not on server; PHP functions denied?
Hi, I have a script that is meant to fetch some data from a third party. It works just fine on my home machine but when I put it on your server, it doesn't work. I'm using the following PHP code; please can you tell me if something has been denied? If so, can you suggest an alternative method? I need to send a GET request with an extra header, in this case named 'Authorization'.
$url and $apikey are defined earlier in the code.
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Authorization: ".$apikey."\r\n"
)
);
$context = stream_context_create($opts);
$file = file_get_contents($url, false, $context);
I never receive the $file variable.
Thank you,
Jo
$url and $apikey are defined earlier in the code.
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Authorization: ".$apikey."\r\n"
)
);
$context = stream_context_create($opts);
$file = file_get_contents($url, false, $context);
I never receive the $file variable.
Thank you,
Jo