PHP code -- curl implement Web Proxy

Source: Internet
Author: User
<? 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.