php-curl icon indicating copy to clipboard operation
php-curl copied to clipboard

logging req an res

Open Majklas opened this issue 4 years ago • 4 comments

Hi, can I get what I'm sending in a file? Like the actual call log.

Majklas avatar Sep 15 '21 12:09 Majklas

I don't quite understand what you mean - what's a call log?

If you have the request and response bodies it's easy enough to var_dump them and/or their methods to see what the headers and such are. Are you looking for something more than that?

anlutro avatar Sep 15 '21 15:09 anlutro

all the post or get I'm sending, I need to get all the trasnfer in a file. like the actual curl data. Is there a method/function to get all of this?

Majklas avatar Sep 15 '21 17:09 Majklas

If you need to do this for security, compliance, or auditing reasons, I would recommend setting up a HTTP proxy which logs everything.

If not, then I think following this SO answer might help you: https://stackoverflow.com/a/51377114/2490608

You just need to use $curl->setDefaultOptions instead of curl_setopt.

anlutro avatar Sep 16 '21 06:09 anlutro

ok, I'll try. Thank you, you may delete this ticket.

Majklas avatar Sep 16 '21 08:09 Majklas