Skip to content

Instantly share code, notes, and snippets.

@Drarok
Forked from anonymous/gist:b346ec1b9cebf1a4bfb8
Last active August 29, 2015 14:01
Show Gist options
  • Save Drarok/73301886f000cac677cc to your computer and use it in GitHub Desktop.
Save Drarok/73301886f000cac677cc to your computer and use it in GitHub Desktop.
<?php
$username = 'trololololol';
$password = 'trololololol';
$url = 'http://some-project.localdev/';
// Set some curl options.
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_HEADER => false, // This is default and could be omitted?
CURLOPT_NOBODY => false, // Also default.
CURLOPT_URL => $url,
CURLOPT_SSL_VERIFYHOST => 0, // Get an SSL cert, you cheapskate.
CURLOPT_USERPWD => $username . ':' . $password,
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_RETURNTRANSFER => true, // Return the transfer as a string of the return value of curl_exec() instead of outputting it out directly to stdout.
));
// Pull the whole thing in to a variable.
$html = curl_exec($ch);
// Close the connection.
curl_close($ch);
echo $html;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment