how to capture CURL / XML data with Apache?

SilverNodashi

Expert Member
Joined
Oct 12, 2007
Messages
3,337
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?
 

mh348

Expert Member
Joined
Jun 2, 2006
Messages
4,211
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.
 

SilverNodashi

Expert Member
Joined
Oct 12, 2007
Messages
3,337
I'm actually looking to capture the "server calls", not the "client side". Everything happens via CURL, there's not much that the client needs to fill in.
 

Nod

Honorary Master
Joined
Jul 22, 2005
Messages
10,057
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.
 

RSkeens

Expert Member
Joined
Jan 5, 2007
Messages
1,647
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
 

SilverNodashi

Expert Member
Joined
Oct 12, 2007
Messages
3,337
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....
 

Kloon

Expert Member
Joined
Nov 6, 2006
Messages
1,670
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.
 

SilverNodashi

Expert Member
Joined
Oct 12, 2007
Messages
3,337
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