Reputation: 21
Probably a stupid question but how on earth does one use cURL within HTML?
I'm trying to set up a Coinbase API and I'm getting error instantly, Is cURL only available in certain websites, React etc? Or can this be used in standard HTML/PHP?
Obviously the first error I'm getting is "unexpected POST".
Coinbase instructions aren't very clear to someone whos never used React or cURL before.
I would be extremely grateful if someone could just explain it a little clearer :)
My undertanding here is that once the "Pay with Crypto" submit button has been clicked I'm assuming this "data.JSON" file is included with the POST info? and it should submit the details to a hosted checkout page, including the .json details/price, right? This might be wrong but I feel I'm on the right track.
This is the code in my html page...
<?php
curl -X POST https://api.commerce.coinbase.com/charges/ \
-H "Content-Type: application/json" \
-H "X-CC-Api-Key: MY_API_KEY" \
-H "X-CC-Version: 2018-03-22" \
-d "@data.json"
?>
Here I have my "data.JSON" file with this code...
{
"name":"TZ",
"description":"Selected Repair Service",
"pricing_type":"<?php echo $fetch['price']; ?>"
}
Upvotes: 1
Views: 5085