Created
December 10, 2012 18:40
-
-
Save jsifalda/4252401 to your computer and use it in GitHub Desktop.
Sending basic authentication via curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $url = 'http://www.example.com'; | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword"); | |
| $result = curl_exec($ch); | |
| echo $result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment