Bonjour à tous.
Je rencontre un petit problème avec paypal IPN.
Après paiement réussi par le client je renvoie les données postées au système paypal pour validation, comme indiqué dans la doc officielle.
Ci-dessous mon code :
Mon problème est que le programme ne passe jamais sur ce test if(strcmp($res, "VERIFIED") == 0) alors que quand j'affiche $res j'obtiens :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 // 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('www.beta-sandbox.paypal.com', 80, $errno, $errstr, 30); if(! $fp) { // ERREUR HTTP $this->erreur(PAYPAL_ERROR_MSG, $Custom->UrlRedirect); } else { fputs($fp, $header . $req); while(! feof($fp)) { $res = fgets($fp, 1024); if(strcmp($res, "VERIFIED") == 0) { // transaction valide ...
J'ai effectué plusieurs tests mais je n'arrive pas à trouver ce qui cloche dans ce code.HTTP/1.1 200 OK
Date: Thu, 04 Feb 2010 13:13:57 GMT
Server: Apache
Set-Cookie: c9MWDuvPtT9GIMyPc3jwol1VSlO=rM7FwBYswz5ShOiHcBpMnSVRl5p_PCChIqakgmQnzvCgC_mq2lVaGjdazt742VY7TluIDHUdELPyX2jtehmR1spKeUEd2uIKpz0tS44TBI9HnQzE-RwWX7G3jAw-cSKFZrpXuW%7chOu1p7HnNfc0Wz7zniKUe7SlDIi6FjsH6Ebnxsd7Sn_SmNRD5TLh3S-gTMgjlfaBL2yk5G%7cA7L_Q1bpYuLqnTG9HEXLAjLEPdWYrXbLwLwaJ1N7AKzwevu5z6aQvHDDaHVBZMvFISjuqm%7c1265289237; domain=.paypal.com; path=/
Set-Cookie: cookie_check=yes; expires=Sun, 02-Feb-2020 13:13:57 GMT; domain=.paypal.com; path=/
Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/
Set-Cookie: navlns=0; expires=Wed, 30-Jan-2030 13:13:57 GMT; domain=.paypal.com; path=/
Set-Cookie: Apache=10.191.196.11.50871265289237365; path=/; expires=Wed, 23-Dec-03 06:45:41 GMT
Connection: close
Content-Type: text/html; charset=UTF-8
VERIFIED
Merci d'avance de votre aide.
Partager