I am using a API and passing a variable to the API\'s function but its working in this case: curl_init(\'https://www.coinpayments.net/api.php?txid=123456\');
I want to
when i fire above api url using browser it show error
API requests can only be made via POST. For documentation see: https://www.coinpayments.net/apidoc
so you have to pass variable as a post parameter using below code
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.coinpayments.net/api.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{'txn_id':".$txn_id."}",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
i got response from above url when i use above code
{
"error": "No HMAC signature sent",
"result": []
}