I\'d like to see what the post fields in the request are before I send it. (For debugging purposes).
The PHP library (class) I am using is already made (not by me),
Output debug info to STDERR:
$curlHandler = curl_init();
curl_setopt_array($curlHandler, [
CURLOPT_URL => 'https://postman-echo.com/get?foo=bar',
CURLOPT_RETURNTRANSFER => true,
/**
* Specify debug option
*/
CURLOPT_VERBOSE => true,
]);
curl_exec($curlHandler);
curl_close($curlHandler);
Output debug info to file:
$curlHandler = curl_init();
curl_setopt_array($curlHandler, [
CURLOPT_URL => 'https://postman-echo.com/get?foo=bar',
CURLOPT_RETURNTRANSFER => true,
/**
* Specify debug option.
*/
CURLOPT_VERBOSE => true,
/**
* Specify log file.
* Make sure that the folder is writable.
*/
CURLOPT_STDERR => fopen('./curl.log', 'w+'),
]);
curl_exec($curlHandler);
curl_close($curlHandler);
See https://github.com/andriichuk/php-curl-cookbook#debug-request