Ec (2); when using curl in the php tutorial, you must first. enable extensionphp_curl.dll in ini. If yes, curl is a built-in browser in php. It can imitate user browsing information for website browsing. Let's look at the following example. Functionpostpage ($ url) {$ response & quot; $ rdrand (1, 4); $ proxyhtt script ec (2); script
When using curl in php tutorial, you must first go to php. enable extension = php_curl.dll in ini. If yes, curl is a built-in browser in php. It can imitate user browsing information for website browsing. Let's look at the following example.
Function postpage ($ url)
{
$ Response = "";
$ Rd = rand (1, 4 );
$ Proxy = 'HTTP: // 221.214.27.253: 8080 ';
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 functions
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