Thomisback Posted May 9, 2008 Share Posted May 9, 2008 Hi, I'm trying to use cURL to visit a few links in an array, the problem is the web page just keeps loading, loading & loading and nothing happens. My code: <?php function OpenDb($hostname,$uid,$pwd,$dbname){ $link = @mysql_pconnect($hostname,$uid,$pwd); if($link && mysql_select_db($dbname)){ return($link); } else{ return(FALSE); } } ?> <?php function QueryIntoArray($query){ settype($retval,"array"); $result= mysql_query($query); if(!$result){ print "Query Failed"; } for($i=0;$i<mysql_numrows($result);$i++){ for($j=0;$j<mysql_num_fields($result);$j++){ $retval[$i][mysql_field_name($result,$j)] = mysql_result ($result,$i,mysql_field_name($result,$j)); }//end inner loop }//end outer loop return $retval; }//end function ?> <!--An Example How To Use The functions To try it simple change the appropriate variable to your own database & tables --> <HTML> <HEAD> <TITLE>PHP Array Test</TITLE> </HEAD> <BODY BGCOLOR=WHITE> <?php OpenDb("etc","etc","pass","etc") or die("Failed Opening Database"); $result = mysql_query("SELECT word FROM words"); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { foreach ($line as $col_value) { $url="test.php?link=$col_value"; echo $url; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_exec($ch); curl_close($ch); } } ?> </BODY> </HTML> The array is received from a database, the table name is "words" and it contains several links which need to be visited by cURL. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/104807-curl-loading-time/ Share on other sites More sharing options...
Thomisback Posted May 9, 2008 Author Share Posted May 9, 2008 Bump Link to comment https://forums.phpfreaks.com/topic/104807-curl-loading-time/#findComment-536674 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.