- First of all... in my previous example, I was specifically going to paypal sandbox 'www.sandbox.paypal.com'
- Secondly... I'm using GoDaddy.com as my hosting service, and this solution, from what I gathered, was addressed specifically at modifying the header for godaddy.
- Here's the code in ipn.php, for the Paypal connection section: I have specifically set the variable $paypaladdr to use "live" or "sandbox" paypal (depending on $CFG->usepaypalsandbox), which is then used in setting the header, and accessing fsockopen.
/// Open a connection back to PayPal to validate the data
$header = '';
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "HOST: ".$paypaladdr.":80\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ($paypaladdr, 80, $errno, $errstr, 30);
fyi... during testing on paypal sandbox.. I'm also setting up the following 2 variables in my config.php file.
- $CFG->usepaypalsandbox = 'TRUE';
- $CFG->enrol_paypalbusiness = 'your test business merchant email here';
Hope this helps...