<? PHP $ Requesturl = 'Ip138. com' ; $ Ch = Curl_init (); $ Timeout = 5 ; Curl_setopt ( $ Ch , Curlopt_url, $ Requesturl ); Curl_setopt ( $ Ch , Curlopt_returntransfer, 1 ); Curl_setopt ( $ Ch , Curlopt_connecttimeout,$ Timeout ); Curl_setopt ( $ Ch , Curlopt_proxyauth, curlauth_basic ); // Proxy Authentication Mode Curl_setopt ( $ Ch , Curlopt_proxy, "112.65.219.72 "); // Proxy server address Curl_setopt ( $ Ch , Curlopt_proxyport, 80 ); // Proxy server port // curl_setopt ($ ch, curlopt_proxyuserpwd, ":"); // HTTP Proxy authentication account, Username: Password format Curl_setopt ( $ Ch , Curlopt_proxytype, curlproxy_http ); // Use HTTP Proxy Mode $ File_contents = Curl_exec ( $ Ch ); Curl_close ( $ Ch ); Echo $ File_contents ; ?>
This sectionCodeCurl is used to implement the Web Proxy function. This is the built-in proxy function of the curl class library, which is not explained too much. It should be noted that the curl class library can be implemented only by changing PHP. ini.