![]() |
Paypal IPN (PHP) Script Issue
On PayPal's side of things, they're saying that everything is working (IPN was sent and the handshake was verified.) with the following php code however, despite this (and that the DB, table, etc is all correct) the data from the sandbox (and live) transaction does not appear to be saving to SQL.
Can any of you with a little more php knowledge than me see any reason why this would be so, or do you think it may be an issue on PayPal's side of things? This is a few steps before I finish up a custom affiliate type script for PayPal and its been giving me grief for a few days now :/ Code:
<?php |
What result do you get? Can you confirm if rows are actually getting added to the database table?
There's one issue straight off the bat - you're not sanitising your database inputs. You should *never* take data straight out of the $_POST array and into an SQL statement, always run it through mysqli_real_escape_string() first. I would confirm what return you are getting from the curl_exec, the compare you are doing means it has to be exactly the word "VERIFIED", if there are any extra characters it won't match. Find out whether the response is what you expect before going any further. Note that if the comparison fails it won't tell you because you're not doing anything with the $error string, maybe echo it to see if the script ends up getting to there. |
Quote:
Yeah this is just being used to get things in order prior to going live so sanitizing isn't a major concern of mine right now, its just my process I throw the script together than add sanitization and binding stuff after, i just find it easier that way. I'll confirm the response and make sure there is no white space now, thanks. |
Right after you do the curl, echo the $response so that you can see it. As rwb said, make sure that you are getting the value you are expecting back. Just because paypal said everything was cool does not mean the data came back properly.
On your strcmp, throw a trim() around $response to get rid of any unexpected spaces (again in line with what rwb said) I would on that same thing throw a strtoupper() around it to make sure you are comparing upper to upper. trim(strtoupper($response)) Since all your database action occurs inside the if, I would say that you are not getting the expected value. |
Thanks, you were both correct, the value it was sending back was malformed.
I appreciate the assistance with this :) |
All times are GMT -7. The time now is 06:45 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc