Example #1
0
 /**
  * Calls an API function
  * @param string $url call method, NO FULL URL
  * @param array $data params for the call
  * @param boolean $userToken set to true if call requires userToken
  * 
  * @return object
  */
 public static function get($url, $data = array(), $userToken = false)
 {
     $call = new self($userToken);
     if (sizeof($data) == 0) {
         $method = 'GET';
     } else {
         $method = 'POST';
     }
     $data['authtoken'] = $call->authToken;
     if ($userToken) {
         $data['usertoken'] = $call->userToken;
     }
     return $call->curl($url, $method, $data);
 }
 public static function fetch($url, $xml = false, $fields = false)
 {
     if (empty($url)) {
         Debug::error("Missing Url for Curl");
         return false;
     }
     $curl = new self();
     if ($xml) {
         $results = $curl->xml($url, $fields);
     } else {
         $results = $curl->curl($url, $fields);
     }
     return $results;
 }