Created
July 10, 2012 17:05
-
-
Save govaniso/3084736 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('parallelcurl.php'); | |
$url1 = 'http://www.soyprogramador.liz.mx/'); | |
$url2 = 'http://www.yahoo.com/'); | |
$url3 = 'http://www.google.com/'); | |
// This function gets called back for each request that completes | |
function on_request_done($content, $url, $ch, $search) { | |
... | |
} | |
$max_requests = 10; | |
$curl_options = array( | |
CURLOPT_SSL_VERIFYPEER => FALSE, | |
CURLOPT_SSL_VERIFYHOST => FALSE | |
); | |
$parallel_curl = new ParallelCurl($max_requests, $curl_options); | |
// Start 3 parallel requests. All three will be started simultaneously. | |
$parallel_curl->startRequest($url1, 'on_request_done'); | |
$parallel_curl->startRequest($url2, 'on_request_done'); | |
$parallel_curl->startRequest($url3, 'on_request_done'); | |
$parallel_curl->finishAllRequests(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment