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