Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require "benchmark.php"; // http://pastebin.com/Jad5TjsQ
- function CURL($url, $post = null, $retries = 2)
- {
- global $errors;
- $curl = curl_init($url);
- if (is_resource($curl) === true)
- {
- curl_setopt($curl, CURLOPT_FAILONERROR, true);
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- if (isset($post) === true)
- {
- curl_setopt($curl, CURLOPT_POST, true);
- curl_setopt($curl, CURLOPT_POSTFIELDS, (is_array($post) === true) ? http_build_query($post, '', '&') : $post);
- }
- $result = false;
- while (($result === false) && (--$retries > 0))
- {
- $result = curl_exec($curl);
- if($result == FALSE)
- $errors["cURL"]++;
- }
- curl_close($curl);
- }
- return $result;
- }
- $result = array();
- $result[10000]['CURL'] = Benchmark('CURL', 'http://wizcorp.mt.dev.wizcorp.jp/', 10000);
- print_r($errors);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement