Bonjour / bonsoir,
pour le site internet d'un ami de vente je fais le paiement par paypal et le retour (IPN) mais rien ne ce passe.
Voici mon code :

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
include('./config.php');
header('HTTP/1.1 200 OK');
$req = "cmd=_notify-validate";
 
// ajoute le message IPN au format NVP à la requête de vérification
foreach ($_POST as $key => $value) {
  $value = urlencode(stripslashes($value));
  $req .= '&$key=$value';
}
 
 
// définition des headers pour la requête de vérification
$header  = "POST /cgi-bin/webscr HTTP/1.0";
 
// test 
//$header .= "Host: www.sandbox.paypal.com:443rn";
 
// production
$header .= "Host: www.paypal.com:443";        
 
$header .= "Content-Type: application/x-www-form-urlencoded";
$header .= "Content-Length: ".strlen($req); 
 
 
// Ouverture du socket
 
// test
//$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
 
// production
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
 
// s'il y a une erreur lors de l'ouverture du socket
if (!$fp) {
 
                    $rech = $bdd->prepare('SELECT * FROM membre WHERE email = ?');
                    $rech->execute(array($_SESSION['connexion']));
                    $rech1 = $rech->fetch();
             $bqs = $bdd->prepare('INSERT INTO list_commandes(nom,id_utilisateur,etat) VALUES(?,?,?)');
        $bqs->execute(array("text", $rech1['id'], "7")); 
}
 
else {
  // on post la requête de vérification
  fputs ($fp, $header . $req);
 
  // créé une boucle tant qu'on est pas arrivé à la fin du fichier
  while (!feof($fp)) {
    // lit la réponse de paypal
    $res = fgets ($fp, 1024);
 
                    $rech = $bdd->prepare('SELECT * FROM membre WHERE email = ?');
                    $rech->execute(array($_SESSION['connexion']));
                    $rech1 = $rech->fetch();
             $bqs = $bdd->prepare('INSERT INTO list_commandes(nom,id_utilisateur,etat) VALUES(?,?,?)');
        $bqs->execute(array("text2", $rech1['id'], "6")); 
    file_put_contents('result.txt', var_export($_POST, true));
 
 
        if (strcmp($res, "VERIFIED") == 0) {
                    $test47 = "";
                 foreach($_SESSION['panier'] as $id_article=>$article_acheté){
        $pwo = $bdd->prepare('SELECT * FROM coques WHERE id = ?');
    $pwo->execute(array($_SESSION['panier'][$id_article]['prix']));
    if($pwo->rowCount() == 1){
        $pwo1 = $pwo->fetch();
    $test47 .= $pwo1['descri']."&nbsp;".$article_acheté['nom']."&nbsp;";
        $total_panier = $pwo1['prix'] * $article_acheté['qte'];
        }
                 }
                   if(isset($_SESSION['panier'][$id_article]['promo'])){
    if(!empty($_SESSION['panier'][$id_article]['promo'])){   
        $test47 .= $total_panier+3-$_SESSION['panier'][$id_article]['promo'];
    }
  }else{
$test47 .= $total_panier+3;
}
                    $rech = $bdd->prepare('SELECT * FROM membre WHERE email = ?');
                    $rech->execute(array($_SESSION['connexion']));
                    $rech1 = $rech->fetch();
             $bqs = $bdd->prepare('INSERT INTO list_commandes(nom,id_utilisateur,etat) VALUES(?,?,?)');
        $bqs->execute(array($test47, $rech1['id'], "5"));  
    }
 
    // si la transaction est invalide
    if (strcmp ($res, 'INVALID') == 0) {
        $rech = $bdd->prepare('SELECT * FROM membre WHERE email = ?');
                    $rech->execute(array($_SESSION['connexion']));
                    $rech1 = $rech->fetch();
             $bqs = $bdd->prepare('INSERT INTO list_commandes(nom,id_utilisateur,etat) VALUES(?,?,?)');
        $bqs->execute(array("text3", $rech1['id'], "6"));    
    }
  }  
 
  fclose ($fp);
}
?>



Mon site internet est belle et bien en https. En vous remerciant.