This blog has been neglected due to the success of Solidshops.com
27Mar/10
paypal ipn postback on a custom port.
When we were developping the paypal IPN script for our ecommerce project solidshops.com, we ran into a strange limition.
Apparently paypal does not allow you to post back to a url with a custom port. Only http(80) and https(443) are allowed.
We solved it by using the paypal ipn proxy below. You should put this script on a different server and it will post all the IPN data to your application on port 8080.
The $url should be changed to the webapplication(on custom port) where the paypal data is processed.
PHP:
$url = 'http://www.yourdomain.com:8080/ipnscript.php'; $fields = $_POST; //url-ify the data for the POST foreach ( $fields as $key => $value ) { $fields_string .= $key . '=' . $value . '&'; } //open connection $ch = curl_init (); //set the url, number of POST vars, POST data curl_setopt ( $ch, CURLOPT_URL, $url ); curl_setopt ( $ch, CURLOPT_POSTFIELDS, $fields_string ); //execute post $result = curl_exec ( $ch ); //close connection curl_close ( $ch ); }
Popularity: 2% [?]


