Forum Moderators: coopster
I'm developing a gateway script that needs to send info to another provider's server, and I need to debug the code.
Is there a way, on my own Linux + Apache + PHP server to capture the CURL / XML data from this script?
I know with PHP, that I could see for example the $_POST, $_GET or $_REQUEST data in a script, but with CURL I don't actually get to the [intranet...] script in my browser - so this doesn't work.
Is there any other way, with a script on the server to capture everything that's passed to the server, and dump it to a database / flat file?
I even tried monitoring /var/logs/http/access_log on the Linux server, but it didn't reveal much
When you curl, you are either retrieving data from a location via get, or posting data to a location and retrieving a response. That's the whole idea of curl. In a payment gateway scenario, you post the details and get a response, and the user never leaves your site for the transaction.
Often that response is a single character (approved/declined) or a string, often XML, but in any case you should be able to store it in a variable and echo it to the page for testing:
$result = curl '[post data]' '[post url]'
echo "<!-- $result -->";
It sounds to me like you're getting "nothing back" and are trying to log it?
Note that you used the word gateway, and some payment providers will not respond if the post comes from a non-secure location, it has to be executed from https: even in test mode. You didn't say payment gateway, but throwing it out there as this is one of the things that gives you "zero response."
Second, figure out where your curl log is, this is where the errors will be. Access logs are for http requests.
Use the -v (verbose) switch when you curl if you can, verbose will give extended messages on the curl. (This may be the incorrect switch for verbose with curl, check docs.)
If none of that helps . . . relevant code please . . .