how to capture CURL / XML data with Apache?

SilverNodashi

Expert Member
Joined
Oct 12, 2007
Messages
3,340
Reaction score
48
Location
Johannesburg, South Africa
Hi,

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 http://intranet/capture.php 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

So, how can I see what the CURL script does, exactly, as the server sees it?
 
Download a firefox addon called httpfox.

Once installed you'll see a small icon at the bottom of the firefox screen, if yo click that and there'll be an option "start", once clicked you can see all the info that is being processed.
 
Have you tried changing the LogFormat settings to include more output?

If that fails, you could always run Wireshark and capture the packets, then inspect the http requests.
 
Just capture the packets, assuming you also want to dump the output:

Code:
tcpdump -n -i <interface> -s 0 -w output.log src or dst port 80
 
Just capture the packets, assuming you also want to dump the output:

Code:
tcpdump -n -i <interface> -s 0 -w output.log src or dst port 80

Thanx, I already tried this with no luck either :(

The script, gateway.php is on the same server as the script gateway2.php - where gateway.php makes it's call to, so it doesn't do anything on the HTTP port. I support I could setup another server, and let the one server call the other server, but that's a lot of work....
 
Note sure if i understand correctly what you are trying to do, but it sounds like you would like to debug the curl requests? if you want to do that try the curl_getinfo php function.
 
Have you tried changing the LogFormat settings to include more output?

If that fails, you could always run Wireshark and capture the packets, then inspect the http requests.

As matter of interest, what would I need to change the LogFormat to?

The current settings are:

Code:
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# "combinedio" includes actual counts of actual bytes received (%I) and sent (%O); this
# requires the mod_logio module to be loaded.
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
 
Top
Sign up to the MyBroadband newsletter
X