Skip to content

Instantly share code, notes, and snippets.

@miku
Created June 28, 2011 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miku/1050208 to your computer and use it in GitHub Desktop.
Save miku/1050208 to your computer and use it in GitHub Desktop.
<?php
$start = microtime();
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "www.google.com");
// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
$stop = microtime();
echo "curl: " . ($stop - $start) . " ms\n";
// ============================================
$start = microtime();
shell_exec("curl -s www.google.com");
$stop = microtime();
echo "shell_exec: " . ($stop - $start) . " ms\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment