Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $start = microtime(true);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "http://packagist.org/p/provider-archived%24d200c2188ebf214eb87e520e3d81d46ea83c9564cb862c87f61095636ecb5d5c.json");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $output = curl_exec($ch);
- curl_close($ch);
- echo "curl: " . (microtime(true) - $start) . "\n";
- $start = microtime(true);
- $context = stream_context_create(array('http' => array('timeout'=> 5)));
- file_get_contents("http://packagist.org/p/provider-archived%24d200c2188ebf214eb87e520e3d81d46ea83c9564cb862c87f61095636ecb5d5c.json", false, $context);
- echo "file_get_contents (w/ timeout): " . (microtime(true) - $start) . "\n";
- $start = microtime(true);
- file_get_contents("http://packagist.org/p/provider-archived%24d200c2188ebf214eb87e520e3d81d46ea83c9564cb862c87f61095636ecb5d5c.json");
- echo "file_get_contents: " . (microtime(true) - $start) . "\n";
- $start = microtime(true);
- $context = stream_context_create(array('http' => array('header'=>'Connection: close\r\n')));
- file_get_contents("http://packagist.org/p/provider-archived%24d200c2188ebf214eb87e520e3d81d46ea83c9564cb862c87f61095636ecb5d5c.json", false, $context);
- echo "file_get_contents (w/ context): " . (microtime(true) - $start) . "\n";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement