Bonjour,
je suis sur se problème et je ne trouve pas de solution depuis des heures .
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.sandbox.paypal.com:443 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\wamp\www\webroot\ipn.php on line 14
voici mon code :
<?php
//permet de traiter le retour ipn de paypal
$email_account = "sell_1328887673_biz@live.fr";
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
$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.sandbox.paypal.com', 443, $errno, $errstr, 30);
$item_name = $_POST'item_name'];
$item_number = $_POST'item_number'];
$payment_status = $_POST'payment_status'];
$payment_amount = $_POST'mc_gross'];
$payment_currency = $_POST'mc_currency'];
$txn_id = $_POST'txn_id'];
$receiver_email = $_POST'receiver_email'];
$payer_email = $_POST'payer_email'];
parse_str($_POST'custom'],$custom);
if (!$fp)
{
}
else
{
fputs ($fp, $header . $req);
while (!feof($fp))
{
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0)
{
// vérifier que payment_status a la valeur Completed
if ( $payment_status == "Completed")
{
if ( $email_account == $receiver_email)
{
/**
* C'EST LA QUE TOUT SE PASSE
* PS : tjrs penser à vérifier la somme !!
*/
file_put_contents('log', print_r($_POST,true));
require "config.php";
mysql_connect(DB_SERVER,DB_LOGIN,DB_PASS);
mysql_select_db(DB_NAME);
mysql_query('SET NAMES'.DB_ENC);
$req = mysql_query('SELECT * FROM offres WHERE prix='.$payment_amount.' LIMIT 1');
$d = mysql_fetch_assoc($req) ;
if (!empty($d))
{
$duration = $d'durer'];
$uid = $custom'uid'];
$datas = serialize($_POST);
mysql_query('UPDATE users set expiration = DATE_ADD(NOW(), INTERVAL '.$duration.' MONTH) WHERE id='.$uid);
mysql_query("INSERT INTO factures set user_id='$uid', amount='$payment_amount', created=NOW(), datas='$datas' ");
file_put_contents('log','Le paiment a bien été confirmé ');
}
else
{
file_put_contents('log','Le paiment ne correspond à aucune offre');
}
}
}
else
{
}
exit();
}
else if (strcmp ($res, "INVALID") == 0)
{
}
}
fclose ($fp);
}
?>
et ma page d erreur :
( ! ) Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.sandbox.paypal.com:443 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in C:\wamp\www\webroot\ipn.php on line 14
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
2 0.0006 704176 fsockopen ( ) ..\ipn.php:14
( ! ) Notice: Undefined index: item_name in C:\wamp\www\webroot\ipn.php on line 15
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
( ! ) Notice: Undefined index: item_number in C:\wamp\www\webroot\ipn.php on line 16
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
( ! ) Notice: Undefined index: payment_status in C:\wamp\www\webroot\ipn.php on line 17
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
( ! ) Notice: Undefined index: mc_gross in C:\wamp\www\webroot\ipn.php on line 18
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
( ! ) Notice: Undefined index: mc_currency in C:\wamp\www\webroot\ipn.php on line 19
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
( ! ) Notice: Undefined index: txn_id in C:\wamp\www\webroot\ipn.php on line 20
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
( ! ) Notice: Undefined index: receiver_email in C:\wamp\www\webroot\ipn.php on line 21
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
( ! ) Notice: Undefined index: payer_email in C:\wamp\www\webroot\ipn.php on line 22
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
( ! ) Notice: Undefined index: custom in C:\wamp\www\webroot\ipn.php on line 23
Call Stack
# Time Memory Function Location
1 0.0005 703040 {main}( ) ..\ipn.php:0
j'ai toujours pas trouver le problème . - j'arrive a créditer mon compte paypal MAIS j'arrive pas a enregistrer en base de donné les information .
une solution?
j'ai trouver quelque indice , dans ton tutoriel sur paypal a 10.50 tu dis qu'il faut atteindre "url par votre ip accessible" , donc jai ouvert le port 80 en tcp et jai mis WAMP "put online" mais rien a faire je trouve pas comment accesder a mon site et je trouve rien du tous ! :(
besoin de votre aide je sais pas quoi faire
Salut ! essai de mettre if (strcmp ($res, "VERIFIED") == -1) et dit moi ! bon bien sur il faudra pas le publier comme ca ! mais je me dit que c'est a cause des comptes sandbox, alors je cherche a savoir si ca marche chez les autres !