To access the Internet in the company's intranet environment, you need to use a proxy. the MMS interface has been called in the Internet environment. how to access the Internet through curl

Source: Internet
Author: User
Tags how to use curl
In the company's intranet environment, you need to use a proxy to access the internet. the MMS interface has been called in the Internet environment. how can I access the Internet through curl, however, the company uses the intranet and requires a proxy server to access the internet. the MMS interface is sent to the specified address through curl post.
$ Url = 'http: // 122.200.77.96/sendMMS ';
$ Header [] = "Content-type: text/xml ";
$ Ch = curl_init ($ url );
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ ch, CURLOPT_HTTPHEADER, $ header );
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ xmlData );
$ Response = curl_exec ($ ch );
If (curl_errno ($ ch )){
Print curl_error ($ ch );
}
Curl_close ($ ch );
This is the post-to-MMS interface code. how to use curl to access the proxy server and then post to the specified interface


Reply to discussion (solution)

Curl_setopt ($ ch, CURLOPT_PROXY, $ this-> data ['proxy']);
Curl_setopt ($ ch, CURLOPT_HTTPPROXYTUNNEL, 1 );
Using these two methods, but I'm sure I can't make myself depressed.

Curl_setopt ($ ch, CURLOPT_PROXY, "proxy server address: Port ");
Curl_setopt ($ ch, CURLOPT_PROXYUSERPWD, "username: password"); // skip this sentence if no

Related Article

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.