Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * _apiCall
- *
- * @access private
- * @access string $path
- * @param array $get_args
- * @return mixed
- */
- private function _apiCall($path, $get_args = array()) {
- $get_string = '';
- if (!$get_args) {
- $get_args = array();
- }
- $get_args['key'] = $this->getApiKey();
- foreach ($get_args as $key => $val) {
- $get_string .= '&'.$key.'='.rawurlencode($val);
- }
- $relative_url = $path.(strlen($get_string) ? '?'.trim($get_string, '&') : '');
- $response = @file_get_contents($this->getApiUrl().$relative_url);
- $data = json_decode($response, true);
- if ($data && is_array($data)) {
- if (isset($data['success']) && $data['success'] == false && isset($data['error'])) {
- error_log('Elophant API Error: '.$data['error']);
- } else {
- return $data;
- }
- } else {
- return $response;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement