Hi,
I know a question like this has probably been asked a million times, and has a very obvious answer but I'm a newbie at PHP and need some help 🙂
I'm making a script for PayPal's Instant Payment Notification in PHP, and I would like to know if the POST vars from PayPal's server act as "normal" vars that don't have to go through anything. Can I just use the vars that came from the PayPal's POST inside my script? I don't know if I'm being clear, but hopefully one of you guys/girls can figure it out 🙂
This is the script I have up to date:
<?
while (list ($key,$value)=each($HTTP_POST_VARS))
{
//echo "$key:$value<br>/n";
$postdata .=$key.'='.$value.'&';
}
$postdata .= 'cmd=_notify-validate';
$url = '';
$command = '/usr/bin/curl -m 120 -d "'.$postdata.'" https://www.paypal.com/cgi-bin/webscr -L';
exec($command, $return_array, $return_value);
if ($return_array[0] == 'INVALID') {
//INVALID RESPONSE
}
else if ($return_array[0] == 'VERIFIED') {
//VERIFIED RESPONSE
//Ie: $stufftogotodbase = $first_name
}
else{
echo("An error has occured somewhere");
}
?>
At the invalid and verified response I want to use the POST vars (ex: the customer's address or whatever from PayPal's server) and put them in a dbase. Can I just use the variable name from PayPal's POST like $first_name in my script?
Thanks a Lot!