Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save JeffreyWay/916246 to your computer and use it in GitHub Desktop.
Save JeffreyWay/916246 to your computer and use it in GitHub Desktop.
<?php
class envato_marketplace {
public static $base_url = 'http://marketplace.envato.com/api/edge/';
public function curl($path) {
$ch = curl_init(self::$base_url . $path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
return json_decode($data);
}
}
$data = envato_marketplace::curl('new-files-from-user:JeffreyWay,tutorials.json');
$data = $data->{'new-files-from-user'};
include 'index.tmpl.php';
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>untitled</title>
</head>
<body>
<?php foreach($data as $item) : ?>
<h2>
<a href="<?php echo $item->url; ?>">
<?php echo $item->item; ?>
</a>
<span> <?php echo $item->sales; ?> </span>
</h2>
<img src="<?php echo $item->live_preview_url;?>" alt="<?php echo $item->item; ?>" />
<?php endforeach; ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment