shab Posted September 13, 2007 Share Posted September 13, 2007 Hi guys, I am having problems with receiving post data from paypal. I have enabled IPN and the URL for it, and have used the code supplied from the book 'Professional Web API with PHP'. After making successful payments using sandbox, the database table is not being updated, i do send my self an email to confirm notification is being sent to that URL. But I am not getting the POST DATA. I am able to enable the redirect and go back to my website and using some of the $_GET data, but i really need to get that POST DATA. I have set up an IPN script . Is the following socket correct? function verifyIPN($data) { $postdata = ""; $response = array(); foreach($data as $i=>$v) { $postdata .= $i . "=" . urlencode($v) . "&"; } $postdata.="cmd=_notify-validate"; $fp=@fsockopen("ssl://www.sandbox.paypal.com" ,"443",$errnum,$errstr,30); if(!$fp) { return "$errnum: $errstr"; } else { fputs($fp, "POST /cgi-bin/webscr HTTP/1.1\r\n"); fputs($fp, "Host: www.sandbox.paypal.com\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ".strlen($postdata)."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $postdata . "\r\n\r\n"); while(!feof($fp)) { $response[]=@fgets($fp, 1024); } fclose($fp); } $response = implode("\n", $response); if(eregi("VERIFIED",$response)) { return true; } else{ return false; } } Can anyone please advise me what to do? Or what im doing wrong? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.