views:

81

answers:

5

Hi
I'm having troubles debugging a POST request I'm making from my web server to another web server.
I'm trying to communicate with a SOAP web service but from some reason a code that worked well from local machine fails when executing on my server
Looking for a way to see the post request my server make to the web service server
web server OS - CentOs
using PHP curl to make the request
Ideas anyone?

+1  A: 

Wireshark? If you've got to connect to the remote end using SSL, then run a stunnel client on the soap client and route requests through that tapping in between.

symcbean
can you detail?I tried wireshark but I can't see my server traffic just my local
Yaniv
A: 

To see the POST on the server

$h=fopen('out.txt','w'); fwrite($h,var_export($_POST,true));

Maybe the curl is disabled on your server

mazgalici
thanks, but it is enabled (working with it on some other functionalities) as for the $_POST it only shooes the post to my server not the post my server makes to other servers
Yaniv
A: 

Or point your client at:

<?php print_r($_POST); ?>

C.

symcbean
this will give me the POST request to my server I need the POST i'm making to the other (not mine) server
Yaniv
Yse - but if you just the server and path in the URL it will still send the same data.
symcbean
A: 

Redirect the post request to a server you control. You can then read the posted data using echo file_get_contents('php://input');

cOle2
+1  A: 

I had the same problem, and using CURLINFO_HEADER_OUT made outgoing request headers show up in debug info.

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$data = curl_exec($ch);
var_dump($data);
$details = curl_getinfo($ch);
var_dump($details);
Kniganapolke