Hello can some one tell me how to make a php paypal IPN like say they pay x money and it will update a table in my database like or insert a row to a table if you know what i mean?

Hello can some one tell me how to make a php paypal IPN like say they pay x money and it will update a table in my database like or insert a row to a table if you know what i mean?
Use paypal api
Okay as i do not know what paypal api and some one told me it good to use IPN for what i want. so can some one help.
I would also consider using PDT as well. Does this help you out?
Code one or get a verified account and get a paypal API from th paypal sie (only verified accounts).
okay i am so lost now as you all say APi , PDT and all so ill ask i just want a script that will like say you pay money and it will like add data to a mysql data base like points or some thing now can i do that?
IPN is the service. API is the download-able script to make your site interact with PayPal.
would some thing like this work
Code:<?php $conn = mysql_connect("****","****","*****"); mysql_select_db(******) or die(mysql_error()); $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 ('www.sandbox.paypal.com', 80, $errno, $errstr, 30); $item_name = test $payment_status = complete $payment_amount = 1.00 $payment_currency = USD $receiver_email = ***************** $payer_email = ************************ if (!$fp) { echo "There was a problem connecting to the IPN server, check your port status."; } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { if ($payment_status != "completed") or ($receiver_email != "[email protected]") or ($payment_amount != "payment amount here") { echo "No paying"; } else { mysql_query("INSERT INTO `goods` (`username`, `key`, `downloadlink`) VALUES('hello', '55453234', 'http://blah.zip')") or die(mysql_error()); } } else if (strcmp ($res, "INVALID") == 0) { echo ('oh well'); } } fclose ($fp); } ?>
Want to hide these adverts? Register an account for free!