Skip to content

Instantly share code, notes, and snippets.

@maurobringolf
Created January 14, 2017 10:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maurobringolf/123bba9fcef5c42330323894d47913e4 to your computer and use it in GitHub Desktop.
Save maurobringolf/123bba9fcef5c42330323894d47913e4 to your computer and use it in GitHub Desktop.
<?php
echo "Running full GET requests... \n";
$sum = 0;
for( $i = 1; $i <= 100; ++$i ) {
$start = microtime(true);
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "http://api.wordpress.org/plugins/info/1.0/woocommerce" );
curl_setopt( $ch, CURLOPT_GET, true );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$result=curl_exec($ch);
$end = microtime(true);
$sum += $end - $start;
}
echo "The average time for a full GET was:" . $sum / 100 . "\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment