Skip to content

Instantly share code, notes, and snippets.

@MattRead
Created September 30, 2014 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattRead/0db9267844c74b08d3e5 to your computer and use it in GitHub Desktop.
Save MattRead/0db9267844c74b08d3e5 to your computer and use it in GitHub Desktop.
<?php
$url = 'https://api.github.com/repos/MattRead/conquistador/git/blobs/82c300571af3a69609466e51c3f057c75cc1df09';
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6\r\n".
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
if ( fopen( $url, "r", false, $context ) != true ) {
echo "bad";
}
else echo "good";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment