Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a curl debug output #44

Open
cboot opened this issue Nov 19, 2022 · 2 comments
Open

Add a curl debug output #44

cboot opened this issue Nov 19, 2022 · 2 comments

Comments

@cboot
Copy link

cboot commented Nov 19, 2022

It'd be great if you could, once the request is totally built, and right before performing it, mark a flag to output the curl as in cli to be able to debug & compare... just saying :D

@tcdent
Copy link
Owner

tcdent commented Nov 19, 2022

Something like this?

$fp = fopen("/tmp/curl_debug", 'w');

$api = new RestClient([
    'curl_options' => [
        CURLOPT_VERBOSE => TRUE, 
        CURLOPT_STDERR => $fp
    ]
]);

$result = $api->get(...);

Also take a look at the curl_getinfo object populated after every request:

var_dump($response->info);

@cboot
Copy link
Author

cboot commented Nov 19, 2022

Just gave a try to this, although it looks great and seems to be good enough to cover most of the needs, i was hoping for more of a CLI output something like:
curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" https://getfedora.org/

But then again, the verbose true seems to be more than enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants