Forum Moderators: buckworks

Message Too Old, No Replies

Paypal IPN: port 80?

port 80 for IPN: server admin says should not be used

         

Alberto

4:53 pm on Sep 14, 2006 (gmt 0)

10+ Year Member



The 'official' documentation at Paypal for basic php IPN managing scripts uses port 80:
[paypal.com...]

However, on my tests (from belahost.com this round) I get this success & error at the same time:

===PASTE===
Successfully Posted to your Script!

Your Script's Reply:
-------------------------------
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Thu, 14 Sep 2006 15:02:35 GMT
Content-type: text/html
X-Powered-By: PHP/5.0.5

HTTP/1.0 500 WebInterface disabled
Pragma: no-cache
Cache-Control: no-cache
Content-type: text/html;charset=utf-8
Connection: close

Requested page cannot be found. Please contact firewall administrator.
===PASTE OVER===

My server adminsitartor says it is impossible that port 80 should be used for a socket because that is reserved for http.
Uhm: anyone has any idea on whether using port 80 is ok as it seems, or on whether that code above could be generated by belahost.com rather than my server? Anyone stumbled into something similar before?

$socket=fsockopen($protocol.$domain, $port, $errno, $errstr, 60);
if($socket===false){
print 'Socket error.';
}
else{
$iwrote=fwrite($socket, $headers.$myPOSTDATA);
while(!feof($socket)){
$paypal_RESPONSE=fgets($socket, 4096);
print $paypal_RESPONSE;/*got the error here*/

thanks

[edited by: Alberto at 4:55 pm (utc) on Sep. 14, 2006]

sun818

7:42 pm on Sep 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think the issue here is that you are using PHP on a Windows servers (IIS 5.0). No offense to ISPs or webhosts but I have found that Windows web admins are usually incompetent when it comes to technology that were originally on Linux.

Alberto

7:59 pm on Sep 14, 2006 (gmt 0)

10+ Year Member



I may also agree, the fact is: good or bad, that is my server. I can't move now db and all elsewhere without then having any certainty on whether it would work, and aside from this paypal issue, honestly they have always been a good server there.

Nonetheless, I still would need to make this Paypal work, after all I know there is plenty of win servers where paypal works fine.

Is anyone who may have an idea what kinda attempts I may do? I obviously talked with my server admin but you never know how long they may take to work things out, so this is why I was looking for suggestions here. Maybethey just won't work out.

Anyone met such a problem, or has suggestions about alternative ports?

ps 443 doesn't work as well, but after all I'm not on ssl

FalseDawn

10:46 pm on Sep 14, 2006 (gmt 0)

10+ Year Member



That code just doesn't look right. I use the code below without issue.

$parameters = 'cmd=_notify-validate';

foreach ($_POST as $key => $value)
{
$parameters .= '&' . $key . '=' . urlencode($value);
}

//uncomment as needed
$server = 'www.paypal.com';
//$server = 'www.sandbox.paypal.com';

$fp = @fsockopen('ssl://' . $server, 443, $errno, $errstr, 30);
$header = 'POST /cgi-bin/webscr HTTP/1.0' . "\r\n" .
'Host: ' . $server . "\r\n" .
'Content-Type: application/x-www-form-urlencoded' . "\r\n" .
'Content-Length: ' . strlen($parameters) . "\r\n" .
'Connection: close' . "\r\n\r\n";

@fputs($fp, $header . $parameters);

while (!@feof($fp))
{
$result = @fgets($fp, 1024);
if (($result == 'VERIFIED') ¦¦ ($result == 'INVALID'))
{
break;
}
}
@fclose($fp);

Alberto

2:15 pm on Sep 15, 2006 (gmt 0)

10+ Year Member



Hello

my code is like yours, of course I posted only a snippet of it, the one where the issue arises. As said the issue is not that it doesn't send the data, it is that after it has sent it, I get that message rather than the verified or invalid response. Port 443 yields the same result.

Anyone used any other port than 80 or 443? The issue is the port. Maybe someone else met this issue before.

Thanks