I created a php script to interact with an API to fetch balance of my account but its not working so I want to see the entire raw curl response with all headers, title and body. How can I achieve this? I'm very new to php so kindly consider this before answering.
<?php
$url = 'https://myapi.com';
$curl = curl_init($url . '?' . http_build_query($query_params));
$params =array();
$secret = "secret";
$post_data = '{}' ;
$checksum = build_checksum($params, $secret, $t, $r,$post_data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl,CURLOPT_HTTP_CONTENT_DECODING, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
'X-API-CODE:"api_code"',
"X-CHECKSUM: {$checksum}",
'Content-Type: application/json'
]);
$response = curl_exec($curl);
curl_close($curl);
$data =json_decode($response);
}
?>
<!DOCTYPE html>
<html lang="en">
<body>
<h2>My wallet</h2>
<br>
<br>
<form method="post">
<input type="submit" name="balance" value ="Check Balance"/>
</form>
<br>
<?php
echo "<h3>Your balance is: </h3>".$data->balance;
echo $data;
?>
</div>
</body>
</html>