php - Getting Paypal Return string into mysql database? -


public function run()     {         $postfields = 'cmd=_notify-validate';          foreach($_post $key => $value)         {             $postfields .= "&$key=".urlencode($value);         }          $ch = curl_init();          curl_setopt_array($ch, array(             curlopt_url => $this->_url,             curlopt_returntransfer => true,             curlopt_ssl_verifypeer => false,             curlopt_post => true,             curlopt_postfields => $postfields         ));          $result = curl_exec($ch);         curl_close($ch);          $fh = fopen('result.txt', 'w');         fwrite($fh, $result . ' -- ' . $postfields);         fclose($fh);          echo $result;     } } ?> 

i result in text file so:

?cmd=_notify-validate&test_ipn=1&payment_type=instant&payment_date=02:39:41 oct 06, 2011 pdt&payment_status=completed&address_status=confirmed&payer_status=verified&first_name=john&last_name=smith&payer_email=buyer@paypalsandbox.com&payer_id=testbuyerid01&address_name=john smith&address_country=united states&address_country_code=us&address_zip=95131&address_state=ca&address_city=san jose&address_street=123, street&business=seller@paypalsandbox.com&receiver_email=seller@paypalsandbox.com&receiver_id=testsellerid1&residence_country=us&item_name=something&item_number=ak-1234&quantity=1&shipping=3.04&tax=2.02&mc_currency=usd&mc_fee=0.44&mc_gross=12.34&mc_gross_1=9.34&txn_type=web_accept&txn_id=41106939¬ify_version=2.1&custom=xyz123&charset=windows-1252&verify_sign=ab3bsjvfd3wxl7rct.oogw-nskg-ahh5rbbovg4bn9lsaon94wjt2oj9

how decode string , put mysql database?

i need customer first name, last name, address,email, item number, item name, quantity, shipping, , timestamp put database. please have come far in code, need decoding , getting database. thanks

you don't need decode string.

i checked paypal documentation. thing notify-validate returns string verified or invalid. none of stuff posted part of paypal return string. if want last name, it's in $_post['last_name'].

to mysql insert statement, (i'm showing 4 columns, can extrapolate fields want):

$stmt = $con->prepare("insert mytable (first_name, last_name, address, email) values (?, ?, ?, ?)"); $stmt->bind_param("ssss", $_post['first_name'], $_post['last_name'], $_post['address'], $_post['email']); $stmt->execute(); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -