PayPal API from GoDaddy
The PHP SDK form PayPal worked great from my dev server but when I went to load it for the client it either completely stalled or timed out. I learned that GoDaddy has a special proxy server you need to use for the cURL option.
$URL="https://api-3t.sandbox.paypal.com/nvp";
if (isset($_GET["site"])) { $URL = $_GET["site"]; }
$ch = curl_init();
//echo "URL = $URL <br>n";
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$nvpreq="METHOD=".urlencode('doDirectPayment')."&VERSION=".urlencode('3.0')."&PWD=".urlencode('yourpass')."&USER=".urlencode('your username)."&SIGNATURE=".urlencode('your signature').$nvpStr;
//setting the nvpreq as POST FIELD to curl
curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);
$response = curl_exec ($ch);
This worked fine for me so i re-created the PayPal Class from their sample code and modified to work with this cURL setting.
Hope it saves you the time I lost.
2 Comments
→
found your site on del.icio.us today and really liked it.. i bookmarked it and will be back to check it out some more later ..
thanks for the info, very useful.. GoDaddy’s a great service, but I never knew that!