PHP: Proxy Servers (cURL)

Setting Authentication Method

Free Anonymous Proxy Browser
I found a good use for typemap. Register a class with a "container" property alone and use the 2 magic methods. Please see the following post. You are doing an awesome job. If you need further assistance using proxy servers please post a question in the proxy server forum. You should then be able to see what is failing and take appropriate action.

Your Answer


If there's an existing wsdl cache file, it needs to be deleted. I had quite a bit of trouble trying to make a request with fopen through a proxy to a secure url. I kept getting a Bad Request back from the remote host. It was receiving the proxy url as the SNI host. It's apparently the issue outlined in this bug: I posted in this URL http: There is defined the server and the client who calls the web service.

I hope it would be useful for you. Just wanted to add this because it was not explicitly specified above. Here's a function for easier debugging: Where you have the problem of "looks like we got no XML document SoapClient", really the real problem is the xml code from remote server is not clear after last tag is possible that you have space or other caracter that the your supplier of service have lost: I've read some solution, like here, but you must to know that is possible, that is possible that the remote server don't wrong, and the "surplus" latin word for added values is needed.

In particolar with axis Java server, is possible that the configuration of server is needed and the "surplus" is one or more attachments The solution is 3: Now you can explode all the part and parse! Hope this can help you. See ya in the cyberspace! If your service is protected through basic http authentication and you're not using wsdl, you will have to put the login in the SoapClient's option: To monitor SOAP calls in and out of a unix server: If you want to use classes in a different namespace in your classmap, just use the backslash in the the target class name.

It should be noted that if you receive a return error: This could be due to something as simple as passing the incorrect parameters. When you look at this XML: Fixing those issues for the other clients however broke PHP's SoapClient to the point where objects being passed to the SOAP method were becoming empty arrays on the server side.

I have created some classes using the explanation below and in other places. Though pointed out by jan at bestbytes, and discussed in bug , one common source of the "Parsing WSDL: I had to struggle with a rather strange behavior when trying to consume standard Parlay X web services with no success. However, I found a remedy to my problem. The problem which I faced was about an erroneous invalid HTTP basic authentication request sent to the web service. Although I was sending the right credentials, I was getting an authentication error.

It turns out that PHP was sending HTTP requests to another endpoint which is not exposed directly through the web service and that end point does not require authentication. My remedy for that issue was by using this simple lines in the example of using sendSms Paraly-X method. First, creating a soap client without any HTTP authentication options: Immediately after this construction we create another soap client, this time with HTTP authentication options: Without the second call, PHP will call sendSms without credentials resulting in a failed attempt due to missing authentication information.

I found this procedure to be the simplest. This process should be done every time the cached wsdl expires, or simply a one can increase the time-to-live for the cached wsdl from php. I had an issue figuring out the use of classmap that took me quite a while to figure out. I dunno if I missed something painfully obvious but maybe this can clear up some of the docs. Our sysadmin believes this is because PHP is not supplying NTLN information Windows security protocol in the correct format and whether it should work with proprietary proxies is of course another debate.

On a slightly related note, if you are having problems make sure the port number is supplied as an integer. Some versions of PHP will not use the proxy with SoapClient if the port number is supplied as a string. This took me a while to figure out. As described at the bottom of here: For all those having problems with that, and no access to the server code: When using classmap option to map the SOAP results to a class, the constructor of the object you've mapped to is not called.

A contact object that has properties initialized i. A contact object without the properties. Thanks for your help. A note regarding boolean values that may seem obvious on reflection but could be a gotcha for some: I have written the wrong exception message in my last post. The correct exception is: This property becomes available after your first client method call.

I have only tested this with session. So, I ended up making a separate WSDL for each possible service needed and had to maintain them all if the service description changed. Finally, after some fiddling, I was able to create a PHP page with the proper Mime type headers so that I could then trick SoapClient to think that it was being passed a file with a ".

I believe it has to go through Apache to properly set the mime type headers, etc If you think this may be happening, I'd tighten up the firewall on the PHP server so that it can only send specified kinds of traffic to specified locations. You should then be able to see what is failing and take appropriate action.

I patched my core code, but one has to track the patches changes on upgrading and it's not nice. If there's a way to make php use systemwide proxy , i have no idea, searching for it was tedious.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service , privacy policy and cookie policy , and that your continued use of the website is subject to these policies.

Home Questions Tags Users Unanswered. How to make PHP use proxy settings to connect to internet? Alexar 1 2 Florian Fida 3 It should work on curl too, at least in the source code there's the logic for it: Have you tried setting environment variables? RedGrittyBrick 3, 1 12 Do a full stop and a restart of Apache before testing. Here is an example:

Browser Settings

Leave a Reply

I'm behind a proxy server that does not allow a direct connection to internet. All of my PHP applications fail to connect to internet for their update checks and etc. How can I tell PHP my Proxy. if you have php >= you could use auto_prepend ini setting to include a script that uses stream_context_set_default() to set a default proxy. but this will only set a proxy for the parts of php which use the default context, didnt test it . Curl is a very useful library for transferring data over various protocols like http, ftp, https etc. In other words curl can be used to programatically download a web page, or upload file to ftp etc. It also supports using a proxy. This means that curl requests can go through a proxy server just.