Skip to content

Instantly share code, notes, and snippets.

@jeffersonchaves
Created December 1, 2023 16:08
Show Gist options
  • Save jeffersonchaves/783a799f23aaabcca14842f95871a194 to your computer and use it in GitHub Desktop.
Save jeffersonchaves/783a799f23aaabcca14842f95871a194 to your computer and use it in GitHub Desktop.
API_MARVEL.php
<?php
$ts = time();
$publicKey = 'ebb5d43c10d70a147fb24321ce1c2ae9';
$privateKey = 'a9ae9afbfb9e68792144677e2e6f5a75fef8a495';
$hash = md5($ts . $privateKey . $publicKey);
$offset = rand(0, 100) * 20;
$url = "https://gateway.marvel.com/v1/public/characters?apikey=$publicKey&hash=$hash&ts=$ts&offset=$offset";
$heroes = file_get_contents($url);
$heroes = json_decode($heroes, true);
$heroes = $heroes['data']['results'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment