I checked and it looks like cURL is enabled inside the php.ini file (I'm using XAMPP) and yet it's still not displaying anything. Same thing goes for file_get_contents. I simply get a blank web page as a result... Somebody has already tested this for me on their local network and it works so I'm really lost right now.
PHP Code:
<?php
$auth = base64_encode("04d2ac7f76a0fbc0eee9dc5ef96b9259:dc70ffc7ad911236bc2e0822855e2d42");
$context = stream_context_create(['http' => ['header' => "Authorization: Basic $auth"]]);
$homepage = file_get_contents("https://api.intrinio...?identifier=AA", false, $context );
$login = '04d2ac7f76a0fbc0eee9dc5ef96b9259';
$password = 'dc70ffc7ad911236bc2e0822855e2d42';
$url = 'https://api.intrinio...?identifier=AA';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
$result = curl_exec($ch);
curl_close($ch);
echo($result);
?>
Anyone has an idea why? Thanks!
CodingForums...
ما را در سایت CodingForums دنبال می کنید
برچسب : نویسنده : codingforums بازدید : 173 تاريخ : سه شنبه 28 آذر 1396 ساعت: 23:22