Bonjour,
J'ai creer un panier paypal et quand mes clients commande quelque chose, paypal me renvoie des information sur la commande.
Mais je voudrais au début de ma page vérifier que c'est bien paypal qui m'envoi cet NPI, est-ce possible??
// renvoyer au système PayPal pour validation
$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);
// lire la publication du système PayPal et ajouter 'cmd'
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
// renvoyer au système PayPal pour validation
$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) {
// ERREUR HTTP
echo 'erreur';
}
else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIE") == 0) {
//
//ICI j'éffectue mes information.
//
}
else if (strcmp ($res, "NON VALIDE") == 0) {
// consigner pour étude manuelle
echo'non valide';
}
}
echo'non valide';
fclose ($fp);
}
Combien cela coûte-t-il au total ? Quelles aides apportent l'état et les acteurs du marché pour alléger cette charge non choisie ? Tous les détails sur Commentçamarche.net.