function send_request($service, $request) { $CI =& get_instance(); $CI->load->helper('API'); $xml = '<?xml version="1.0"?><AccessRequest xml:lang="en-US"><AccessLicenseNumber>' . $this->key . '</AccessLicenseNumber><UserId>' . $this->user . '</UserId><Password>' . $this->pass . '</Password></AccessRequest>'; $auth = new SimpleXMLElement($xml); $response = simplexml_load_string(API_Request('POST', 'https://onlinetools.ups.com/ups.app/xml/' . $service, null, null, null, $auth->asXML() . $request->asXML())); return $response; }
private function _request($method, $data = array()) { // Define Global Parameters $params['apikey'] = $this->key; $params['prettyPrint'] = 'true'; $params['wrapRoot'] = 'false'; // Append Global Parameters $data = array_merge($data, $params); // Fetch Data $api = API_Request('GET', 'https://api.mediatemple.net/api/v1/' . $method, $data); // On Success, Decode JSON Into Array if ($api) { $api = json_decode($api, true); } //Return Data if (isset($api->errors)) { return false; } else { return $api; } }
function validate($ykid) { $CI =& get_instance(); $CI->load->helper(array('glab_api', 'array')); $params['id'] = 3468; $params['otp'] = $ykid; $result['status'] = 'Server did not respond or response empty.'; $api = API_Request('GET', 'http://api.yubico.com/wsapi/verify', $params); foreach (explode("\n", $api) as $pair) { if (preg_match('/([a-z]+)=/i', $pair, $chunk)) { $key = $chunk[1]; $value = trim(substr($pair, strlen($key) + 1)); $result[$key] = $value; } } $this->status = element('status', $result); if (element('status', $result) == 'OK') { return TRUE; } else { return FALSE; } }
function Feed_Request($url, $params = null, $cacheAge = 1800) { return API_Request('GET', $url, $params, null, null, null, $cacheAge); }