Page 1 sur 1

Problème avec mon script Paypal IPN

Posté : 25 juin 2009, 17:07
par stefane321
Bonjour amis programmeurs,

bon, j'ai un drole de problème avec mon script Paypal IPN.

Au départ, jai pris le script ici: https://paypaltech.com/sg2/

Le script fonctionne ET ne fonctionne pas ... on dirait que sa dépend du serveur.

Sur mon serveur à moi sa marche mais sur celui de mon client sa marche pas.

Je vous colle une partie du code ... la partie à problème:

Code original:
(C'est un échantillon car j'ai une page entière de variable)



/////////////////////////////////////////////////
/////////////Begin Script below./////////////////
/////////////////////////////////////////////////

// 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);


// assign posted variables to local variables
$item_name = $_POST['item_name'];
$business = $_POST['business'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$mc_gross = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$receiver_id = $_POST['receiver_id'];
$quantity = $_POST['quantity'];
$num_cart_items = $_POST['num_cart_items'];
$payment_date = $_POST['payment_date'];
$first_name = $_POST['first_name'];
     $strQuery = "insert into paypal_payment_info(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,itemnumber,itemname,os0,on0,os1,on1,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$item_number."','".$item_name."','".$option_name1."','".$option_selection1."','".$option_name2."','".$option_selection2."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')";
    $result = mysql_query("insert into paypal_payment_info(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,itemnumber,itemname,os0,on0,os1,on1,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$item_number."','".$item_name."','".$option_name1."','".$option_selection1."','".$option_name2."','".$option_selection2."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')") or die("Default - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
Sur le serveur du client dans les log d'erreur sa me donne des :

Code : Tout sélectionner

[Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: amount1 in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 85 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: amount2 in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 86 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: amount3 in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 87 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: mc_amount1 in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 88 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: mc_amount2 in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 89 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: mcamount3 in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 90 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: recurring in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 91 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: reattempt in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 92 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: retry_at in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 93 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: recur_times in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 94 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: username in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 95 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: password in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 96 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: for_auction in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 100 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: auction_closing_date in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 101 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: auction_multi_item in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 102 [Wed Jun 24 17:05:39 2009] [error] [client 216.113.191.33] PHP Notice: Undefined index: auction_buyer_id in /home/webadmin/coursespagnol.ca/html/test_notify4.php on line 103
Alors, j'ai donc modifié le code ainsi:
if(isset($_POST['item_name'])){$item_name = $_POST['item_name'];}else{$item_name  ="";}
if(isset($_POST['business'])){$business = $_POST['business'];}else{$business  ="";}
if(isset($_POST['item_number'])){$item_number = $_POST['item_number'];}else{$item_number  ="";}
if(isset($_POST['payment_status'])){$payment_status = $_POST['payment_status'];}else{$payment_status  ="";}
if(isset($_POST['mc_gross'])){$mc_gross = $_POST['mc_gross'];}else{$mc_gross  ="";}
if(isset($_POST['mc_currency'])){$payment_currency = $_POST['mc_currency'];}else{$payment_currency  ="";}
if(isset($_POST['txn_id'])){$txn_id = $_POST['txn_id'];}else{$txn_id  ="";}
if(isset($_POST['receiver_email'])){$receiver_email = $_POST['receiver_email'];}else{$receiver_email  ="";}
if(isset($_POST['receiver_id'])){$receiver_id = $_POST['receiver_id'];}else{$receiver_id  ="";}
if(isset($_POST['quantity'])){$quantity = $_POST['quantity'];}else{$quantity  ="";}
if(isset($_POST['num_cart_items'])){$num_cart_items = $_POST['num_cart_items'];}else{$num_cart_items = "";}
if(isset($_POST['payment_date'])){$payment_date = $_POST['payment_date'];}else{$payment_date  ="";}
if(isset($_POST['first_name'])){$first_name = $_POST['first_name'];}else{$first_name  ="";}
if(isset($_POST['last_name'])){$last_name = $_POST['last_name'];}else{$last_name  ="";}
if(isset($_POST['payment_type'])){$payment_type = $_POST['payment_type'];}else{$payment_type  ="";}
if(isset($_POST['payment_status'])){$payment_status = $_POST['payment_status'];}else{$payment_status  ="";}
if(isset($_POST['payment_gross'])){$payment_gross = $_POST['payment_gross'];}else{$payment_gross  ="";}

Là il ni a plus d'erreur de indefined variable mais la requete sql pour enregistré les données ne reçois pas les variables (sur le serveur du client)

Sur mon serveur tout fonctionne même avec la modification du code.

Voici les renseignement sur les serveurs:

Mon serveur, celui où sa fonctionne: http://www.atlantisinformatique.com/phpinfo.php

Le serveur du client, là où sa ne fonctionne pas: http://www.coursespagnol.ca/phpinfo.php

En espérant que vous pourrez m'aider ... merci!

Posté : 26 juin 2009, 18:35
par Nagol
dzl aucune expérience en paypal ici, en espérant qu'un autre de nos helpers ait une expérience sur le sujet.