When using curl in PHP, you must first open Extension=php_curl.dll in front of the php.ini; go, Curl is a built-in browser in PHP, it can imitate the user browsing information for web browsing, and so on, see an example, the code is as follows:
function Postpage ($url)
{
$response = "";
$rd =rand (1,4);
$proxy = ' http://221.214.27.253:808 ';
if ($rd ==2) $proxy = ' http://222.77.14.56:8088 ';
if ($rd ==3) $proxy = ' http://202.98.123.126:8080 ';
if ($rd ==4) $proxy = ' http://60.14.97.38:8080 ';
if ($url! = "") {
$ch = Curl_init ($url);
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_returntransfer, true);
curl_setopt ($ch, Curlopt_proxy, $proxy);
$response = curl_exec ($ch);
if (Curl_errno ($ch)) $response = "";
Curl_close ($ch);
}
return $response;
}
Curl includes some of the functions as follows:
Curl_close-close a Curl session
Curl_copy_handle-copy a curl handle along with all of its preferences
Curl_errno-return the last Error number
Curl_error-return A string containing the last error for the current session
Curl_exec-perform a Curl session
Curl_getinfo-get information regarding a specific transfer
Curl_init-initialize a Curl session
Curl_multi_add_handle-add a normal curl handle to a curl multi handle
Curl_multi_close-close a set of curl handles
Curl_multi_exec-run the sub-connections of the current curl handle
Curl_multi_getcontent-return the content of a curl handle if Curlopt_returntransfer is set
Curl_multi_info_read-get information about the current transfers
Curl_multi_init-returns a new Curl multi handle
Curl_multi_remove_handle-remove a multi handle from a set of curl handles
Curl_multi_select-wait for activity on any curl_multi connection
Curl_setopt_array-set multiple options for a curl transfer
Curl_setopt-set an option for a curl transfer
Curl_version-gets Curl Version Information