Friday, April 4, 2008

GoDaddy cURL HTTPS and nusoap.php problem

I was working on client's site that needed to access data via web service from another site via nusoap.php library and simply could not get it to work. Same exact script that I've developed for one of my other clients that was being hosted with HostMySite worked perfectly!

So I stated to debug nusoap to see what part of it was causing this error - it turned to be stalling at cURL request. cURL worked fine when I would point it to unsecure http:// site, but as soon as https:// was thrown in the combination cURL failed. After playing around with and exasting my options with nusoap.php library I called GoDaddy support to shed some light on this. I learned that they use proxy for their cURL calls that are made to secure sites. The issue is actually described in their HELP section.

Needless to say I was mad that I've spent all that time debugging nusoap while solution was two lines of code long:

curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128");

Adding above two lines to your nusoap library at line 2400 in latest version 0.7.3 will do the trick. This is applicable to any script hosted on godaddy shared hosting needing to access HTTPS urls via cURL library. I found Mauricio Zuniga's Blog that talks about this same issue unfortunately only after wasted all that time.
After going through this ordeal, I again encountered problems with DOMDocument php modules on GoDaddy server so decided to move my clients site to www.hostmysite.com who offer THE BEST support and actually appreciate my business.