Skip to content

Instantly share code, notes, and snippets.

@zvineyard
Created July 19, 2012 22:18
Show Gist options
  • Save zvineyard/3147253 to your computer and use it in GitHub Desktop.
Save zvineyard/3147253 to your computer and use it in GitHub Desktop.
PHP: file_get_contents() HTTP Login
$context = stream_context_create(array(
'http' => array(
'header' => "Authorization: Basic " . base64_encode("$username:$password")
)
));
$data = file_get_contents($url, false, $context);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment