Welcome! Log In Create A New Profile


[PHP] apache curl

Posted by Roman Gelfand 
Roman Gelfand
[PHP] apache curl
February 24, 2017 05:30AM
I am executing successfully the following code using php line mode and it
returns a stream. However, when running the same code as part of web page,
it appears that get request never gets executed. Why? any help is

$apikey = '73f1ad78334ea3e8dedfb8f568d8537f';

$ch = curl_init();

$headr = array();
$headr[] = 'Accept: application/json';
$headr[] = 'Content-Type: application/json';
$headr[] = 'Authorization '.$apikey.':1';

curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,
$content = curl_exec($ch);
echo $content;

R. Gelfand
Sorry, only registered users may post in this forum.

Click here to login