Created
October 7, 2014 14:06
-
-
Save salgo/e24b17b4863756eddc6a to your computer and use it in GitHub Desktop.
Funky bit of PHP for testing 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 | |
if ($argc == 1) { | |
die("Specify a url!"); | |
} | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $argv[1]); | |
curl_setopt($ch, CURLOPT_VERBOSE, true); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
echo curl_exec($ch); | |
if (curl_errno($ch)) { | |
echo curl_errno($ch) . ' ' . curl_error($ch) . "\n"; | |
} | |
curl_close($ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment