Skip to content

Instantly share code, notes, and snippets.

@salgo
Created October 7, 2014 14:06
Show Gist options
  • Save salgo/e24b17b4863756eddc6a to your computer and use it in GitHub Desktop.
Save salgo/e24b17b4863756eddc6a to your computer and use it in GitHub Desktop.
Funky bit of PHP for testing curl
<?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