Making a HTTP GET request with HTTP-Basic authentication
Marc B did a great job of answering this question. I recently took his approach and wanted to share the resulting code. <?PHP $username = “some-username”; $password = “some-password”; $remote_url=”http://www.somedomain.com/path/to/file”; // Create a stream $opts = array( ‘http’=>array( ‘method’=>”GET”, ‘header’ => “Authorization: Basic ” . base64_encode(“$username:$password”) ) ); $context = stream_context_create($opts); // Open the file … Read more