PHP CURL Collection Problem---Please advise
PHP code
PHP Code
$url) {$conn [$k]=curl_init ($url); curl_setopt ($conn [$k], curlopt_timeout, $timeout);//Set time-out curl_setopt ($conn [$k], Curlopt_useragent, ' mozilla/5.0 ( Compatible MSIE 5.01; Windows NT 5.0) '); curl_setopt ($conn [$k], Curlopt_maxredirs, 7),//http orientation level curl_setopt ($conn [$k], Curlopt_header, 0);//Do not HEADER, add block efficiency curl_setopt ($conn [$k], curlopt_followlocation, 1); 302 redirect Curl_setopt ($conn [$k],curlopt_returntransfer,1); Curl_multi_add_handle ($MH, $conn [$k]); }//Prevent death cycle consumes the CPU this paragraph is based on the online notation do {$MRC = Curl_multi_exec ($MH, $active);//When no data, active=true} while ($MRC = = Curlm_call_multi_perform);//When data is being accepted while ($active and $MRC = = CURLM_OK) {//when there is no data or when a request is paused, active=true if (Curl_multi_select ($MH)! =-1) {do {$MRC = Curl_multi_exec ($MH, $active); } while ($MRC = = Curlm_call_multi_perform); }} foreach ($array as $k = = $urL) {curl_error ($conn [$k]); $res [$k]=curl_multi_getcontent ($conn [$k]);//obtain return information $header [$k]=curl_getinfo ($conn [$k]);//return header information Curl_clos E ($conn [$k]);//close handle Curl_multi_remove_handle ($MH, $conn [$k]); Free resources} curl_multi_close ($MH); $endtime = Getmicrotime (); $diff _time = $endtime-$startime; Return Array (' diff_time ' = = $diff _time, ' return ' and ' $res, ' header ' = ' $header '); Calculates the current time function getmicrotime () {list ($usec, $sec) = Explode ("", Microtime ()); return (float) $usec + (float) $sec);} Test, curl 1 urls $array = Array ("Http://www.120ask.com/keshi.asp?c=69&a=&l=0&p=1",); $data = Curl_http ($array, ' 1 ');//Call Var_dump ($DATA);//Output?>
Libeay32.dll, Ssleay32.dll, Php5ts.dll, Php_curl.dll all copied to system32 directory, restart Apache
PHP.ini turned on CURL.
But I still can't. Error message
Fatal error:call to undefined function curl_multi_init () inch D:\wamp\www\caiji\caiji.php on line 4
------Solution--------------------
Phpinfo (); see if there's no curl, and if it doesn't, you're not successful at all (Extension=php_curl.dll)
------Solution--------------------
Well, you're not set right, try it.
------Solution--------------------
You look at your phpinfo () The PHP configuration file is the one you modified it? For example, you turn off the MySQL module in the Open Phpinfo () to see if the MySQL module is turned on, if it is still open, then the PHP configuration file you used is not the one you modified
------Solution--------------------
Title Party.
------Solution--------------------
PHP CURL Collection Problem---Please advise
You should ask:
Curl installation is unsuccessful---please advise
Have you ever restarted Apache and killed php-cgi?
------Solution--------------------
This can be used.
PHP code
array (3) {["Diff_time"]=> float (1.0497448444366) ["Return"]=> Array (1) {[0]=> NULL} ["Header"]=> Array (1) {[0]=> array () {["url"]=> string () "http:/ /www.120ask.com/keshi.asp?c=69&a=&l=0&p=1 "[" Content_Type "]=> NULL [" Http_code "]=> int (0) [" Header_size "]=> int (0) [" request_size "]=> int (0) [" filetime "]=> Int ( -1) [" Ssl_verify_result "]=> int (0) [" Redirect_count "]=> int (0) [" Total_time "]=> float (1) [" Namelookup_time "]=> float (1) [" Connect_time "]=> Float (0) ["Pretransfer_time"]=> float (0) ["Size_upload"]=> float (0) ["Size_download"]=> float (0) ["Speed_ Download "]=> float (0) [" Speed_upload "]=> float (0) [" Download_content_length "]=> float ( -1) [" Upload_content_ Length "]=> float ( -1) [" Starttransfer_time "]=> float (0) [" Redirect_time "]=> float (0)}}}