Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A lightweight method added
- Loading branch information
Showing
70 changed files
with
129 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
// Get data for all coins from Coinmarketcap API | ||
$ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_URL, "https://files.coinmarketcap.com/generated/search/quick_search.json"); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
$output = curl_exec($ch); | ||
curl_close($ch); | ||
|
||
// Replace quotes that might break the json decode | ||
$output = str_replace("'", "", $output); | ||
|
||
// Decode json data to use as a php array | ||
$outputdecoded = json_decode($output, true); | ||
|
||
|
||
foreach ($outputdecoded as $coin) { | ||
|
||
// Get CMC ID | ||
$cmcid = $coin["id"]; | ||
|
||
// Get public ID | ||
$pubid = $coin["slug"]; | ||
|
||
echo($cmcid); | ||
echo($pubid); | ||
|
||
// Using the CMC ID build the link for logo | ||
$file_url = "https://files.coinmarketcap.com/static/img/coins/16x16/" . $cmcid . ".png"; | ||
|
||
// Get file logo, rename it and save | ||
$image = file_get_contents($file_url); | ||
$img_path = "coins/16x16/" . $pubid . ".png"; | ||
file_put_contents($img_path, $image); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
// Get data for all coins from Coinmarketcap API | ||
$ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_URL, "https://files.coinmarketcap.com/generated/search/quick_search.json"); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
$output = curl_exec($ch); | ||
curl_close($ch); | ||
|
||
// Replace quotes that might break the json decode | ||
$output = str_replace("'", "", $output); | ||
|
||
// Decode json data to use as a php array | ||
$outputdecoded = json_decode($output, true); | ||
|
||
|
||
foreach ($outputdecoded as $coin) { | ||
|
||
// Get CMC ID | ||
$cmcid = $coin["id"]; | ||
|
||
// Get public ID | ||
$pubid = $coin["slug"]; | ||
|
||
echo($cmcid); | ||
echo($pubid); | ||
|
||
// Using the CMC ID build the link for logo | ||
$file_url = "https://files.coinmarketcap.com/static/img/coins/32x32/" . $cmcid . ".png"; | ||
|
||
// Get file logo, rename it and save | ||
$image = file_get_contents($file_url); | ||
$img_path = "coins/32x32/" . $pubid . ".png"; | ||
file_put_contents($img_path, $image); | ||
} | ||
|
||
?> |
File renamed without changes.
File renamed without changes.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Oops, something went wrong.
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Diff not rendered.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Diff not rendered.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
Oops, something went wrong.
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
// Get data for all coins from Coinmarketcap API | ||
$ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_URL, "https://files.coinmarketcap.com/generated/search/quick_search.json"); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
$output = curl_exec($ch); | ||
curl_close($ch); | ||
|
||
// Replace quotes that might break the json decode | ||
$output = str_replace("'", "", $output); | ||
|
||
// Decode json data to use as a php array | ||
$outputdecoded = json_decode($output, true); | ||
|
||
// Build CMC links for each coin | ||
foreach ($outputdecoded as $coin) { | ||
$string .= "![". $coin["slug"] ."](https://raw.githubusercontent.com/dziungles/cryptocurrency-logos/master/coins/16x16/" . $coin["slug"] . ".png) "; | ||
} | ||
|
||
echo($string); | ||
|
||
?> |