Organizational Research By

Surprising Reserch Topic

how can i use curl to open multiple urls simultaneously with php using -'php,mysql,curl,curl-multi'


how can i use curl to open multiple urls simultaneously with php  using -'php,mysql,curl,curl-multi'

Here is my current code:

    $SQL = mysql_query("SELECT url FROM urls") or die(mysql_error()); //Query the urls table
while($resultSet = mysql_fetch_array($SQL)){ //Put all the urls into one variable

                // Now for some cURL to run it.
            $ch = curl_init($resultSet['url']); //load the urls
            curl_setopt($ch, CURLOPT_TIMEOUT, 2); //No need to wait for it to load. Execute it and go.
            curl_exec($ch); //Execute
            curl_close($ch); //Close it off
        } //While loop


I'm relatively new to cURL. By relatively new, I mean this is my first time using cURL. Currently it loads one for two seconds, then loads the next one for 2 seconds, then the next. however, I want to make it load ALL of them at the same time. I'm sure its possible, I'm just unsure as to how. If someone could point me in the right direction, I'd appreciate it.
    
asked Sep 7, 2015 by rajesh
0 votes
58 views



Related Hot Questions



Government Jobs Opening


...