How to log outgoing http requests from PHP + cURL?

You can use tcpdump to sniff some packets on the server, something like this:

# tcpdump -vv -s0 tcp port 80 -w /tmp/apache_outgoing.pcap

and run your PHP script to see what happens.


Is there any way to restrict it to a) Only POST data,

You can sniff all and filter with http.request.method == POST in Wireshark.

b) Only coming from 1.1.1.1

# tcpdump -vv -s0 tcp port 80 and src host 1.1.1.1

and c) only going to 2.2.2.2 ?

# tcpdump -vv -s0 tcp port 80 and dst host 2.2.2.2

Read the tcpdump's man page for more details.