Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Usage: yourpath/file.php?s=1 - [1..8]
- */
- function get_dataa($url) {
- $ch = curl_init();
- $timeout = 5;
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
- curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
- $data = curl_exec($ch);
- curl_close($ch);
- return $data;
- }
- $sites = array("",
- "themeforest", //-1
- "codecanyon", //-2
- "videohive", //-3
- "audiojungle", //-4
- "graphicriver", //-5
- "photodune", //-6
- "3docean", //-7
- "activeden"); //-8
- if( !isset($_GET['s']) )
- exit;
- if( (int)$_GET['s']>0 && (int)$_GET['s']<9 ){
- $index = (int)$_GET['s'];
- $url = "http://marketplace.envato.com/api/edge/categories:$sites[$index].json";
- $data = get_dataa($url);
- $cats = array();
- if( !empty($data) ){
- $json = json_decode($data);
- if( isset($json->categories) ){
- foreach ($json->categories as $value) {
- $cats []= array( 'name'=>$value->name, 'path'=>$value->path );
- }
- }
- }
- echo '<option value="http://'.$sites[$index].'.net/feeds/new-'.$sites[$index].'-items.atom" title="All feed">All Categories Feed</option>';
- echo "<br>";
- foreach ($cats as $value) {
- $name = $value['name'];
- $path = $value['path'];
- $p = str_replace("/", "-slash-", $path);
- $uri = "http://$sites[$index].net/feeds/new-$p-items.atom";
- $xp = explode("/", $path);
- $count = count($xp)-1;
- $title = str_repeat("&nbsp;&nbsp;&nbsp;", $count) . $name;
- echo '<option value="'.$uri.'">'.$title.'</option>';
- echo "<br>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment