[PHP] IPN error

2006-04-29 Thread suresh kumar
Hi,
   I am new to this IPN (instant payment
notification.I am working for past 6 hours.I am using
this IPN to store payment details in our database.

when user clicks the paypal button in my page.it
will take to paypal.com website.after user completes
the payments.It will send the payment details to my
page.where i can process and store in the database.

This is the Code for paypal button:
---
 form action=https://www.paypal.com/cgi-bin/webscr;
method=post
 input type=image
src=https://www.paypal.com/en_US/i/btn/x-click-but20.gif;
border=0 name=submit alt=Make payments with
PayPal - it's fast, free and secure! disabled
 img alt= border=0
src=https://www.paypal.com/en_US/i/scr/pixel.gif;
width=1 height=1
 input type=hidden name=notify_url
value=http://myadtv.com/Gauranga/confirmation_message.php;
 input type=hidden name=cmd
value=_xclick-subscriptions
 input type=hidden name=business
value=[EMAIL PROTECTED]
 input type=hidden name=item_name
value=Subscribe to Additional User Account Yearly
 input type=hidden name=item_number
value=2
 input type=hidden name=no_shipping
value=1
 input type=hidden name=no_note
value=1
 input type=hidden name=currency_code
value=USD
 input type=hidden name=bn
value=PP-SubscriptionsBF
 input type=hidden name=a1
value=0.00
 input type=hidden name=p1 value=3
 input type=hidden name=t1 value=D
 input type=hidden name=a3
value=59.95
 input type=hidden name=p3 value=1
 input type=hidden name=t3 value=Y
 input type=hidden name=src
value=1
 input type=hidden name=sra
value=1

 /form



my page code to  process paypal
--
?
 
// 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 ('www.paypal.com', 80, $errno,
$errstr, 30);

// assign posted variables to local variables

$item_name = $_POST['item_name'];
$item_number=$_POST['item_number'];
$shipping_status = $_POST['no_shipping'];
$note_status = $_POST['no_note'];
$currency = $_POST['currency_code'];
$business_name = $_POST['bn'];
$payment_amount = $_POST['a3'];
$payment_duration_num = $_POST['p3'];
$payment_duration = $_POST['t3'];
$txn_id = $_POST['txn_id'];
//$receiver_email = $_POST['receiver_email'];
//$payer_email = $_POST['payer_email'];
$payment_status = $_POST['payment_status'];





if (!$fp)
{

 print $errstr ($errno)br /\n;
}
else
{
include('db.php');
$transactionidretrieveresult=mysql_query(select
* from BillingInfo where Transaction_ID='$txn_id');
 fputs ($fp, $header . $req);
   while (!feof($fp)) {
   $res = fgets ($fp, 1024);
 if (strcmp ($res, VERIFIED) == 0) {
if(($payment_status==Completed) and
(!mysql_num_rows($transactionidretrieveresult))):

   //storing in Database;
   

  endif;

  }
 elseif (strcmp ($res, INVALID) == 0)
  {
print Click The Link  To Go To MyADTV
Add New User Account Pagea
href=\adduseraccounts.php\Click Here/a;
  }
 
fclose ($fp);
}
?


 When i visit my page i am displaying this error


 Undefined index:item_name,Undefined
index:item_number,Undefined index:a1,Undefined
index:p1,Undefined index:t1,Undefined index:a3,and so
on.


I am waiting response from any one


,



__ 
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] IPN error

2006-04-29 Thread Richard Lynch
On Sat, April 29, 2006 3:53 am, suresh kumar wrote:
  input type=hidden name=item_name
 value=Subscribe to Additional User Account Yearly

 my page code to  process paypal
 --
 ?

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

echo $key = $valuebr /\n;

 }

 $item_name = $_POST['item_name'];

$item_name = isset($_POST['item_name']) ? $_POST['item_name'] : '';


  Undefined index:item_name

The $_POST data is not filled in, either because this is your FIRST
visit to the page, or because something is not doing a POST request
the way you think it should be.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] IPN error

2006-04-29 Thread Stephen Lake
Use cURL I found it much easier then using fsockopen

http://ca.php.net/cURL


Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Sat, April 29, 2006 3:53 am, suresh kumar wrote:
  input type=hidden name=item_name
 value=Subscribe to Additional User Account Yearly

 my page code to  process paypal
 --
 ?

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

 echo $key = $valuebr /\n;

 }

 $item_name = $_POST['item_name'];

 $item_name = isset($_POST['item_name']) ? $_POST['item_name'] : '';


  Undefined index:item_name

 The $_POST data is not filled in, either because this is your FIRST
 visit to the page, or because something is not doing a POST request
 the way you think it should be.

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] IPN error

2006-04-29 Thread Stephen Lake
One more thing, make sure you validate ALL data that is being sent from 
paypal to ensure what you need and expect are therealso validate the 
transaction ID to ensure it was never used before.


Stephen Lake [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Use cURL I found it much easier then using fsockopen

 http://ca.php.net/cURL


 Richard Lynch [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 On Sat, April 29, 2006 3:53 am, suresh kumar wrote:
  input type=hidden name=item_name
 value=Subscribe to Additional User Account Yearly

 my page code to  process paypal
 --
 ?

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

 echo $key = $valuebr /\n;

 }

 $item_name = $_POST['item_name'];

 $item_name = isset($_POST['item_name']) ? $_POST['item_name'] : '';


  Undefined index:item_name

 The $_POST data is not filled in, either because this is your FIRST
 visit to the page, or because something is not doing a POST request
 the way you think it should be.

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php