I use PHP and cURL to post data to API. I got the result. Now i want to see the HTTP request (header, body...)
$ch = curl_init();
$dataPost = json_encode($arr);
curl_setopt($ch, CURLOPT_URL, 'http://huypv.net/demo/post.php');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_TIMEOUT, 45);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataPost);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
#'Authorization: key=' . $apiKeyFromFirebase,
));
#$curl_log = fopen("curl.txt", 'c+'); // open file for READ and write
$curl_log = fopen('php://temp', 'w+');
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $curl_log);
$ret = curl_exec($ch);
rewind($curl_log);
#$output= fread($curl_log, 2048);
$output = stream_get_contents($curl_log);
echo $output;
fclose($curl_log);
curl_close($ch);
var_dump($ret);