1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP- file get contents & cURL not displaying anything

Discussion in 'HTML & Website Design' started by Frenzyy, Dec 18, 2017.

  1. #1
    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
    $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);
    ?>
    SEMrush
    Anyone has an idea why? Thanks!
     
    Frenzyy, Dec 18, 2017 IP
    SEMrush