View Full Version : Receiving POST data through proxy (paypal IPN listener)

12-13-2010, 10:35 PM
I'm trying to set up paypal payment processing on my website. I have godaddy shared hosting (<--mistake) and I'm trying my hardest to not switch hosts. The payments process fine, it is the listener that I'm having problems with. Paypal POSTs data to a script for which you set the url to a "listener" script in your settings. When a payment is made.... they POST the data to the listener script... you encode the data...append it all together plus another variable and send it back to be verified that it matches... Well I'm not too worried about the script working and all that... the problem is I'm not even RECEIVING the post. I have a simple foreach loop gather and append the data into a string. I have it set up right now to insert into MYSQL just so I can SEE if it's working....You can check your IPN history and I can see that payments are made but paypal is sending it over and over it's in a "retrying" state with a 408 error. My server is not sending a 200ok response.

After 4 days of bashing my head against the wall I figured out that there's a problem with godaddy shared hosting.. If I use a virtual private server with the SAME script from godaddy it works just fine. But on the shared hosting it blocks it for some reason...After calling paypal and godaddy countless times with them pointing their finger at each other... one godaddy support rep tells me that I should set my script up with a proxy and he gave me info which I will show you in the script... This is what I need help with right. How can I receive POST data through a proxy in my script....

I want to add that this doesn't make sense to me because in my script I also have the word "yes" insert into MYSQL even if the script is hit at all... All this time my script is NEVER even touched by paypal... So.. if I add this proxy stuff... how will let my script even be accessed? I'm not sure how servers work together too well to process things. It just didn't seem like the proxy thing would even help when my script can't even be accessed it seems. Any help is appreciated.

Here is the code I'm working with:

$con = mysql_connect("","","") or die(mysql_error());
$db = mysql_select_db("swellshirt",$con);

$ip = ""; // proxy IP <-- IP...
$port = 3128; // proxy port
$url_proxy = 'http://proxy.shr.secureserver.net';

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {

$value = urlencode(stripslashes($value));
$req .= "&$key=$value";


mysql_query("INSERT INTO orders (description, street) VALUES ('$req', 'yes') ")
or die(mysql_error());

12-14-2010, 04:28 AM
Is this IPN you're doing? If so, you may want to try out the Paypal sandbox. There is an IPN simulator in there that helps a lot when troubleshooting IPN.


Create an account and once you're logged in you'll see "test tools" on the left.

12-14-2010, 06:12 PM
yes I've used that and I got an error everytime... but I solved the problem... It's godaddys' shared hosting.. No one can use an IPN listener and have data POSTed to their server with their shared hosting. It just won't work. For some reason they block. I have moved hosts and everything is fine now. Godaddy shared hosting is cheap but has it's limits.