jsquared
08-20-2004, 11:05 PM
New to the Paypal IPN and trying to figure out why I can't get it to work. I trapped the error that I get when Paypal tries to run my script, "resource temporarily unavailable". Any ideas for the cause of this/?
Here's the relevant code:
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$status = $_POST['payment_status'];
$amount = $_POST['mc_gross'];
$txn_id = $_POST['txn_id'];
etc.
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
if (!$fp)
exit();
else {
fputs ($fp, $header . $req);
....
Burhan
08-21-2004, 02:23 AM
You might need to connect to the https port.
The error you are getting is from the webserver running at Paypal. Most likely your link is wrong (probably it needs to be https, not http).
I would suggest using cURL for this.
mixDev
08-21-2004, 01:55 PM
I have a similar problem, Ikobo IPN says we can open their remote file using fopen() to an 'https' URL. I dont have SSL in myserver. Can i use fsockopen and change the port to secure port insted of 80? I didnt try it yet.
Burhan
08-22-2004, 03:21 AM
Yes, fsockopen will connect the correct port if you change 80 to the https port.
I would recommend you use cURL -- since its designed for these things.
A few other alternatives include Snoopy (http://snoopy.sf.net) and HTTP_Client (http://pear.php.net/package/HTTP_Client).
mixDev
08-22-2004, 01:40 PM
Thanks fyrestrtr.
Yeah. snoopy helped me a lot when i was doing myscripts.
jsquared
08-22-2004, 09:22 PM
Thanks for the ideas. Will look into it further and hopefully figure it out. Though I tried some other sample code snips from some 3rd party Paypal sites and still get the same problem. Jsut to eliminiate the possibility, is there the possible of some sort of firewall or other limitation on my account that would prevent this? This is running on a Cpanel account on Servermatrix, though I run the server so if there are changes that may need to be made, I can do it. I only ask this because I noticed that ping and traceroute from this account using SSH don't work either.
robertson
08-23-2004, 01:12 AM
Hi,
I also suggest using curl as did fyrestrtr. Because it gives you lots of options and easy to handle...although I never tried out snoopy or HTTP Client....but I have used curl for IPN integration in domain registration site...it works flawlessly:)
Krishnendu
mixDev
08-23-2004, 02:42 AM
jsquared, do you think all outbound traffic from your site is not working?
try a simple remote fopen() so some site first. Or are you trying that already?
what is the paypal ipn ??