Paypal IPN problem

crazymonster

Junior Member
Joined
Apr 8, 2011
Messages
167
Reaction score
30
Payment is fine. Paypal IPN History shows ?Sent?

When payment is done and paypal back me to my success page, received firefox bug:

Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party.

Are you sure you want to continue sending this information?

When I click "continue", Paypal send request to ipn.php
ipn.php doesn't create ipn_errors.log , maybe hosting doesnt allow ...

But ipn.php doesn't work, because MySql doesn't update. It's posible $verified variable to be empty?

I used for guide:
https://github.com/Quixotix/PHP-PayPal-IPN
 
<?php


mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_select_db("PayPal") or die(mysql_error());


// 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";
}
// post back to PayPal system to validate
$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";


$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {


// PAYMENT VALIDATED & VERIFIED!


}


else if (strcmp ($res, "INVALID") == 0) {


// PAYMENT INVALID & INVESTIGATE MANUALY!


}
}
fclose ($fp);
}
?>


maybe it helps you.
 
Back
Top