Skip to content

Instantly share code, notes, and snippets.

@truth3
Created July 8, 2019 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save truth3/31bcccb63b5cad7da451a01dd5e180dc to your computer and use it in GitHub Desktop.
Save truth3/31bcccb63b5cad7da451a01dd5e180dc to your computer and use it in GitHub Desktop.
Used to fetch the latest crypto prices from Coin Market cap and avoid the rate limiting issues when requesting from Google
<?php
$cryptoID = $_GET["crypto_id"];
$requestUrl ='https://api.coinmarketcap.com/v1/ticker/' . $cryptoID . '/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $requestUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
$response = curl_exec($ch);
echo($response);
curl_close($ch);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment