nfdevil

api

Oct 26th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * To change this template, choose Tools | Templates
  5.  * and open the template in the editor.
  6.  */
  7.  
  8. /**
  9.  * Description of GiantBombApi
  10.  *
  11.  * @author Devil
  12.  */
  13. class GiantBombApi {
  14.     private $privatekey = '';
  15.     private $baseurl = 'http://api.giantbomb.com/';
  16.     private $resource = '';
  17.     private $filters = array();
  18.    
  19.     public function __construct() {
  20.        
  21.     }
  22.     public function getGames($filters){
  23.         $this->resource = 'games';
  24.         //if(!is_array($filters)){ $filters = array($filters); }
  25.         //array_merge($this->filters,array('test'));
  26.         var_dumper($this->filters);
  27.         echo $this->buildUrl();
  28.     }
  29.     private function buildUrl(){
  30.         $url = $this->baseurl . '?api_key=' . $this->privatekey;
  31.         if(count($this->filters) != 0){
  32.             $url .= '&field_list=' . explode(',', $this->filters);
  33.         }
  34.         return $url;
  35.     }
  36. }
  37.  
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment