本文整理汇总了PHP中Unirest\Request::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::get方法的具体用法?PHP Request::get怎么用?PHP Request::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unirest\Request
的用法示例。
在下文中一共展示了Request::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* @param string|array $param Options or ID
* @return \stdClass
*/
public function fetch($param)
{
if (is_string($param)) {
return new Payment($this->response(Request::get(Endpoints::fetch($param))->raw_body));
} else {
$response = json_decode(Request::get(Endpoints::fetch($param))->raw_body, true);
$json['entity'] = "collection";
foreach ($response as $key => $item) {
$json['items'][$key] = new Payment($this->response($item));
}
return $this->response($json);
}
}
示例2: getSubdistrict
public function getSubdistrict($city_id, $subdistrict_id = NULL)
{
$params = is_null($city_id) ? NULL : array('city' => $city_id);
if (!is_null($subdistrict_id)) {
$params['id'] = $subdistrict_id;
}
return \Unirest\Request::get($this->getEndPoint() . "subdistrict", $this->getHeader(), $params)->body->rajaongkir->results;
}
示例3: getInfo
public function getInfo($url, $inputs = null, $param = null)
{
$url = setApiUrl($url, $param);
//Log::info($url."\n");
$response = Unirest\Request::get($url, $this->_headers, $inputs);
//Log::info(json_encode($response)."\n");
return dealResponse($response);
}
示例4: getPlayUrl
/**
* 获取播放地址
* @return array
*/
public function getPlayUrl()
{
$response = \Unirest\Request::get($this->url);
preg_match('#value=\'(?<url>.*?)\'><a id="v_slink_souce"#', $response->body, $m);
if (!empty($m['url'])) {
return ['swf' => trim($m['url'])];
}
return false;
}
示例5: avaliable
/**
* Checks if the daemon is running.
*
* @param string $ip
* @param int $port
* @param int $timeout
* @return bool
*/
public function avaliable($ip, $port = 5656, $timeout = 3)
{
Unirest\Request::timeout($timeout);
try {
Unirest\Request::get("https://" . $ip . ":" . $port);
return true;
} catch (\Exception $e) {
return false;
}
}
示例6: searchContactList
/**
* Get list of searched contact list
* @param string $q Required parameter: Your keyword or query.
* @return string response from the API call*/
public function searchContactList($q)
{
//check that all required arguments are provided
if (!isset($q)) {
throw new \InvalidArgumentException("One or more required arguments were NULL.");
}
//the base uri for api requests
$_queryBuilder = Configuration::$BASEURI;
//prepare query string for API call
$_queryBuilder = $_queryBuilder . '/search/contacts-lists';
//process optional query parameters
APIHelper::appendUrlWithQueryParameters($_queryBuilder, array('q' => $q));
//validate and preprocess url
$_queryUrl = APIHelper::cleanUrl($_queryBuilder);
//prepare headers
$_headers = array('user-agent' => 'ClickSendSDK');
//set HTTP basic auth parameters
Request::auth(Configuration::$username, Configuration::$key);
//and invoke the API call request to fetch the response
$response = Request::get($_queryUrl, $_headers);
//Error handling using HTTP status codes
if ($response->code == 400) {
throw new APIException('BAD_REQUEST', 400, $response->body);
} else {
if ($response->code == 401) {
throw new APIException('UNAUTHORIZED', 401, $response->body);
} else {
if ($response->code == 403) {
throw new APIException('FORBIDDEN', 403, $response->body);
} else {
if ($response->code == 404) {
throw new APIException('NOT_FOUND', 404, $response->body);
} else {
if ($response->code == 405) {
throw new APIException('METHOD_NOT_FOUND', 405, $response->body);
} else {
if ($response->code == 429) {
throw new APIException('TOO_MANY_REQUESTS', 429, $response->body);
} else {
if ($response->code == 500) {
throw new APIException('INTERNAL_SERVER_ERROR', 500, $response->body);
} else {
if ($response->code < 200 || $response->code > 206) {
//[200,206] = HTTP OK
throw new APIException("HTTP Response Not OK", $response->code, $response->body);
}
}
}
}
}
}
}
}
return $response->body;
}
示例7: retrieveConfig
/**
* A Config object has the following attributes:+ `timezone` - Our sever timezone+ `now` - Our server timestamp+ `version` - Current version is "1.0"+ `serverUrl` - Main API URL+ `photosUrl` - Base Path to server where we store our images+ `productsSorting` - Available Products lists sorting options (can be combined with commas, for example &sort=date,-price ) + `date` - Date ascending + `-date` - Date descending + `price` - Price ascending + `-price` - Price descending + `distance` - Distance ascending (works only if `latitude`,`longitude` & `distance` parameters are provided, ignored otherwise) + `-distance` - Distance descending (works only if `latitude`,`longitude` & `distance` parameters are provided, ignored otherwise)+ user - All important userdata for provided API key + `name` - Name / Company / Organization + `email` - E-Mail Address + `uuid` - Unique ID + `continueUrl` - Continue URL (not in use now) + `notifyUrl` - Notify URL (not in use now) + `suggestedMarkup` - Suggested markup, % decimal value, for example 7.5 + `defaultPagination` - Default Pagination value (per page), between 1-100 + `defaultSortBy` - Default sort by for /products (if not specified) + `defaultCurrencyUuid` - Default currency UUID for /products (if not specified) + `defaultCurrencyCode` - Default currency code for /products (if not specified) + `defaultLanguageUuid` - Default language UUID /products (if not specified) + `defaultLanguageCode` - Default language code /products (if not specified) + `walletBalance` - Partner's available wallet balance, based on his deposits + `walletAvailableBalance` - Wallet balance which is a combination of partner's deposit and assigned credit amount + `wallet_alert_value` - Threshold value in SGD, when `walletBallance` reach this value then BMG and partner will be notified on this event+ `languages` - A list of supported languages.+ `currencies` - An array of supported currencies.+ `types` - An array of supported products types.+ `categories` - A tree of supported product categories.+ `locations` - A tree of supported locations. (Continent -> Country -> State -> City)
* @return mixed response from the API call
* @throws APIException Thrown if API call fails
*/
public function retrieveConfig()
{
//the base uri for api requests
$_queryBuilder = Configuration::$BASEURI;
//prepare query string for API call
$_queryBuilder = $_queryBuilder . '/v1/config';
//validate and preprocess url
$_queryUrl = APIHelper::cleanUrl($_queryBuilder);
//prepare headers
$_headers = array('user-agent' => 'BeMyGuest.SDK.v1', 'Accept' => 'application/json', 'X-Authorization' => Configuration::$xAuthorization);
//call on-before Http callback
$_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl);
if ($this->getHttpCallBack() != null) {
$this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
}
//and invoke the API call request to fetch the response
$response = Request::get($_queryUrl, $_headers);
//call on-after Http callback
if ($this->getHttpCallBack() != null) {
$_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
$_httpContext = new HttpContext($_httpRequest, $_httpResponse);
$this->getHttpCallBack()->callOnAfterRequest($_httpContext);
}
//Error handling using HTTP status codes
if ($response->code == 400) {
throw new APIException('Wrong Arguments', $_httpContext);
} else {
if ($response->code == 401) {
throw new APIException('Unauthorized', $_httpContext);
} else {
if ($response->code == 403) {
throw new APIException('Forbidden', $_httpContext);
} else {
if ($response->code == 404) {
throw new APIException('Resource Not Found', $_httpContext);
} else {
if ($response->code == 405) {
throw new APIException('Method Not Allowed', $_httpContext);
} else {
if ($response->code == 410) {
throw new APIException('Resource No Longer Available', $_httpContext);
} else {
if ($response->code < 200 || $response->code > 208) {
//[200,208] = HTTP OK
throw new APIException("HTTP Response Not OK", $_httpContext);
}
}
}
}
}
}
}
$mapper = $this->getJsonMapper();
return $mapper->map($response->body, new Models\RetrieveConfigResponse());
}
示例8: getReferralAccounts
/**
* Get all referral accounts
* @return string response from the API call*/
public function getReferralAccounts()
{
//the base uri for api requests
$_queryBuilder = Configuration::$BASEURI;
//prepare query string for API call
$_queryBuilder = $_queryBuilder . '/referral/accounts';
//validate and preprocess url
$_queryUrl = APIHelper::cleanUrl($_queryBuilder);
//prepare headers
$_headers = array('user-agent' => 'ClickSendSDK');
//set HTTP basic auth parameters
Request::auth(Configuration::$username, Configuration::$key);
//and invoke the API call request to fetch the response
$response = Request::get($_queryUrl, $_headers);
//Error handling using HTTP status codes
if ($response->code == 400) {
throw new APIException('BAD_REQUEST', 400, $response->body);
} else {
if ($response->code == 401) {
throw new APIException('UNAUTHORIZED', 401, $response->body);
} else {
if ($response->code == 403) {
throw new APIException('FORBIDDEN', 403, $response->body);
} else {
if ($response->code == 404) {
throw new APIException('NOT_FOUND', 404, $response->body);
} else {
if ($response->code == 405) {
throw new APIException('METHOD_NOT_FOUND', 405, $response->body);
} else {
if ($response->code == 429) {
throw new APIException('TOO_MANY_REQUESTS', 429, $response->body);
} else {
if ($response->code == 500) {
throw new APIException('INTERNAL_SERVER_ERROR', 500, $response->body);
} else {
if ($response->code < 200 || $response->code > 206) {
//[200,206] = HTTP OK
throw new APIException("HTTP Response Not OK", $response->code, $response->body);
}
}
}
}
}
}
}
}
return $response->body;
}
示例9: dic
public function dic()
{
$data = Request::capture();
// https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
$response = \Unirest\Request::get("https://glosbe.com/gapi/translate", null, array('from' => 'eng', 'dest' => 'eng', 'format' => 'json', 'phrase' => $data['word'], 'pretty' => 'false', 'tm' => 'true'));
$ms = json_decode($response->raw_body);
// dd($ms);
// Get Examples in $ms->examples. English in $ms->examples->first, Other Language in $ms->examples->second
$examples = array();
// Get English Meaning in $ms->meanings, other language in $ms->phrase
$meanings = array();
if (count($ms->examples) > 0) {
$i = 0;
foreach ($ms->examples as $key => $value) {
if (isset($value->first)) {
$examples += array($key => $value->first);
}
$i++;
if ($i >= 5) {
break;
}
}
}
// dd($examples);
if (isset($ms->tuc)) {
if (count($ms->tuc) > 0) {
$ms = json_decode($response->raw_body)->tuc[0]->meanings;
}
// dd($ms[0]->text);
// dd($ms);
$i = 0;
foreach ($ms as $key => $value) {
$meanings += array($key => $value->text);
$i++;
if ($i >= 5) {
break;
}
}
}
// dd($meanings);
echo json_encode(['meanings' => $meanings, 'examples' => $examples]);
// dd(['examples' => $examples, 'meanings' => $meanings]);
}
示例10: parse
/**
* 解析下载地址
*
* @param string $url 页面地址
*
* @return array
*/
public function parse($url)
{
$flvcd_url = 'http://www.flvcd.com/parse.php?kw=' . urlencode($url);
$response = \Unirest\Request::get($flvcd_url);
$html = iconv('GB2312', 'UTF-8//IGNORE', $response->body);
// 下载地址
preg_match_all('#href="(?<url>.*?)".*?onclick=\'_alert\\(\\);return false;\'#', $html, $m);
$down_list = [];
if (!empty($m['url'])) {
foreach ($m['url'] as $key => $value) {
$down_list[] = trim($value);
}
}
// 名称
preg_match('#document.title = "(?<title>.*?)" \\+#', $html, $m);
$title = empty($m['title']) ? '' : trim($m['title']);
if (empty($down_list) || empty($title)) {
return [];
}
return ['title' => $title, 'down_list' => $down_list];
}
示例11: call
/**
* The underlying call to the Kong Server
*
* @throws \Ignittion\Kong\KongException when something goes wrong with the Http request
*
* @param string $verb
* @param string $uri
* @param array $options
* @param array $body
* @return \stdClass
*/
public function call($verb, $uri, array $params = [], array $body = [], array $headers = [])
{
$verb = strtoupper($verb);
$api = "{$this->url}:{$this->port}/{$uri}";
$headers = array_merge($headers, ['Content-Type: application/json']);
try {
switch ($verb) {
case 'GET':
$request = RestClient::get($api, $headers, $params);
break;
case 'POST':
$request = RestClient::post($api, $headers, $body);
break;
case 'PUT':
$request = RestClient::put($api, $headers, $body);
break;
case 'PATCH':
$request = RestClient::patch($api, $headers, $body);
break;
case 'DELETE':
$request = RestClient::delete($api, $headers);
break;
default:
throw new Exception('Unknown HTTP Request method.');
}
} catch (Exception $e) {
throw new KongException($e->getMessage());
}
// save this request
$this->body = $request->body;
$this->headers = $request->headers;
$this->httpCode = $request->code;
$this->rawBody = $request->raw_body;
// return a more simplified response
$object = new stdClass();
$object->code = $this->httpCode;
$object->data = $this->body;
return $object;
}
示例12: get
/**
* Send the request
*
* @return GenderizeResponse
*/
public function get()
{
$headers = array('Accept' => 'application/json');
$response = $this->request->get(self::API_URL, $headers, $this->buildQuery());
return new GenderizeResponse($response);
}
示例13: getProductsList
/**
* ###ResponseA response object has the following attributes: + `uuid` - UUID of product+ `published` - true / false,+ `title` - Title of product. Always on English+ `titleTranslated` - Title of product on requested language+ `description` - Description of product. Always on English+ `descriptionTranslated` - Description of product on requested language+ `highlights` - Highlights of product. Always on English+ `highlightsTranslated` - Highlights of product on requested language+ `additionalInfo` - Additional information of product. Always on English+ `additionalInfoTranslated` - Additional information of product on requested language+ `priceIncludes` - What's included in product price+ `priceIncludesTranslated` - Translated version of `priceIncludes`+ `itinerary` - Activity itinerary - only applicable for Package type, will be `NULL` for others+ `itineraryTranslated` - translated version of itinerary+ `warnings` - Warnings of the activity (related to safety and insurance)+ `warningsTranslated` - translated version of warnings+ `safety` - activity safety information+ `safetyTranslated` - translated version of safety information+ `latitude` - Latitude+ `longitude` - Longitude+ `minPax` - Minimum number of pax+ `maxPax` - Maximum number of pax+ `basePrice` - Base price of product (for list only)+ `currency` - Currency+ `isFlatPaxPrice` - `true/false` (An indication to tell if the `Product` has the same price for each pax in all of its `productTypes` for the selected date. )+ `reviewCount` - Number of reviews+ `reviewAverageScore` - Average score+ `typeName` - Type of product+ `typeUuid` - Type UUID+ `businessHoursFrom` - supplier business hours `from`+ `businessHoursTo` - supplier business hours `to`+ `meetingTime` - meeting time+ `hotelPickup` - `true/false` + `meetingLocation` - instructions about meeting location with supplier+ `meetingLocationTranslated` - translated version of meeting location+ `photosUrl` - Base URL for images+ `photos` - Array of photos in different dimensions (Sizes: original, 75x50, 175x112, 680x325)+ `categories` - Array of categories+ `locations` - Information about product location+ `url` - URL of product If you requested only unpublished (`published` = `false`) products then the list will be simplified.Each element will consist only of these attributes: { "data": [ { "uuid":"b03ce312-742f-5256-bfe2-014daf1c8d01", "published":false, "title":"Everest BaseCamp Trek - 16 Days", "titleTranslated":null }, { "uuid":"d70fb77c-3e97-591e-b876-d638a643c41b", "published":false, "title":"Half day rock climbing, Ha Long Bay, Vietnam", "titleTranslated":null } [...] }If you requested only deleted (`deleted` = `false`) products then the list will be simplified.In this case `published` parameter will be ignored.This parameter exists to help partners to synchronize its cached products database.Each element will consist only of these attributes: { "data": [ { "uuid":"b03ce312-742f-5256-bfe2-014daf1c8d01", "deletedAt":"2015-06-01 14:28:37", "title":"Everest BaseCamp Trek - 16 Days", "titleTranslated":null }, { "uuid":"d70fb77c-3e97-591e-b876-d638a643c41b", "published":"deletedAt":"2015-06-01 14:28:37", "title":"Half day rock climbing, Ha Long Bay, Vietnam", "titleTranslated":null } [...] }###RequestA request can take these parameters:+ `type`: `b90bd912-3e92-52e6-8abb-c2722cf947db` (optional, string) - UUID of type of product+ `country`: `ebbfac98-5f89-5106-9c4e-9e5dfd485231` (optional, string) - UUID of country+ `city`: `f67e3919-036d-11e5-a2a9-d07e352b4840` (optional, string) - UUID of city - it will always overwrite (nullify) country parameter if provided+ `price_min`: 25.00 (optional, decimal) - minimal price in decimal format 000.00 - it's compared to base price+ `price_max`: 100.00 (optional, decimal) - max price in decimal format 000.00+ `category`: `5a6495b5-9a58-5257-93db-902ca3cf8b40` (optional, string) - UUID of litsing category+ `pax`: `2` (optional, integer) - number of guests+ `currency`: `79efbd4e-3648-5204-8f35-a0e51661a4c7` (optional, string) - currency UUID, also currency code may be provided in exchange+ `language`: `ZH-HANS` (optional, string) - language UUID, also language code may be provided+ `date_start`: `2015-06-25` (optional, string) - product start date, format YYYY-MM-DD+ `date_end`: `2015-06-30` (optional, string) - product end date, format YYYY-MM-DD+ `query`: `diving in Bali` (optional, string) - free phrase for text search for example &query=Bali+ `duration_days_min`: `0` (optional,integer) - product duration minimum days (default 0)+ `duration_days_max`: `0` (optional,integer) - product duration maximum days (default NULL)+ `latitude`: `1.313430` (optional, float) - search in distance radius: latitude value + `longitude`: `103.883768` (optional, float) - search in distance radius: longitude value+ `distance`: `10.5` (optional, float) - search in distance radius in km - to use this param you need to provide always 3 parameters: latitude, longitude and distance+ `sort`: `price` (optional, string) - sorting field, example: &sort=date,-price or &sort=price+ `page`: `5` (optional, integer) - page number for results+ `per_page`: `25` (optional, integer) - how many results per page - if not provided default value from user account will be used+ `published`: `true` (optional, string) - default is set to true, if set to false then a list of shortened unpublished products will be returned+ `deleted`: `false` (optional, string) - default is set to false, if set to true then a list of shortened deleted products will be returned
* @param string $category Optional parameter: UUID of litsing category
* @param string $city Optional parameter: UUID of city, it will always overwrite country parameter if provided
* @param string $country Optional parameter: UUID of country
* @param string $currency Optional parameter: currency UUID, also currency code may be provided in exchange
* @param string $dateEnd Optional parameter: product end date, format YYYY-MM-DD
* @param string $dateStart Optional parameter: product start date, format YYYY-MM-DD
* @param string $deleted Optional parameter: default is set to `false`
* @param string $distance Optional parameter: Distance in km
* @param integer $durationDaysMax Optional parameter: product duration maximum days (default NULL)
* @param integer $durationDaysMin Optional parameter: product duration minimum days (default 0)
* @param string $language Optional parameter: language UUID, also language code may be provided. It will overwrite the default language from user account
* @param string $latitude Optional parameter: Latitude value
* @param string $longitude Optional parameter: Longitute value
* @param double $page Optional parameter: page number for results
* @param double $pax Optional parameter: number of people
* @param double $perPage Optional parameter: how many results per page - if not provided default value from user account will be used
* @param integer $priceMax Optional parameter: max price in decimal format 000.00
* @param integer $priceMin Optional parameter: minimal price in decimal format 000.00 - it's compared to base price
* @param string $published Optional parameter: default is always set to `true`
* @param string $query Optional parameter: free phrase for text search for example &query=Bali
* @param string $sort Optional parameter: sorting field, example: &sort=date,-price or &sort=price
* @param string $type Optional parameter: UUID of type of product
* @return mixed response from the API call
* @throws APIException Thrown if API call fails
*/
public function getProductsList($category = NULL, $city = NULL, $country = NULL, $currency = NULL, $dateEnd = NULL, $dateStart = NULL, $deleted = NULL, $distance = NULL, $durationDaysMax = NULL, $durationDaysMin = NULL, $language = NULL, $latitude = NULL, $longitude = NULL, $page = NULL, $pax = NULL, $perPage = NULL, $priceMax = NULL, $priceMin = NULL, $published = NULL, $query = NULL, $sort = NULL, $type = NULL)
{
//the base uri for api requests
$_queryBuilder = Configuration::$BASEURI;
//prepare query string for API call
$_queryBuilder = $_queryBuilder . '/v1/products';
//process optional query parameters
APIHelper::appendUrlWithQueryParameters($_queryBuilder, array('category' => $category, 'city' => $city, 'country' => $country, 'currency' => $currency, 'date_end' => $dateEnd, 'date_start' => $dateStart, 'deleted' => $deleted, 'distance' => $distance, 'duration_days_max' => $durationDaysMax, 'duration_days_min' => $durationDaysMin, 'language' => $language, 'latitude' => $latitude, 'longitude' => $longitude, 'page' => $page, 'pax' => $pax, 'per_page' => $perPage, 'price_max' => $priceMax, 'price_min' => $priceMin, 'published' => $published, 'query' => $query, 'sort' => $sort, 'type' => $type));
//validate and preprocess url
$_queryUrl = APIHelper::cleanUrl($_queryBuilder);
//prepare headers
$_headers = array('user-agent' => 'BeMyGuest.SDK.v1', 'Accept' => 'application/json', 'X-Authorization' => Configuration::$xAuthorization);
//call on-before Http callback
$_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl);
if ($this->getHttpCallBack() != null) {
$this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
}
//and invoke the API call request to fetch the response
$response = Request::get($_queryUrl, $_headers);
//call on-after Http callback
if ($this->getHttpCallBack() != null) {
$_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
$_httpContext = new HttpContext($_httpRequest, $_httpResponse);
$this->getHttpCallBack()->callOnAfterRequest($_httpContext);
}
//Error handling using HTTP status codes
if ($response->code == 400) {
throw new APIException('Wrong Arguments', $_httpContext);
} else {
if ($response->code == 401) {
throw new APIException('Unauthorized', $_httpContext);
} else {
if ($response->code == 403) {
throw new APIException('Forbidden', $_httpContext);
} else {
if ($response->code == 404) {
throw new APIException('Resource Not Found', $_httpContext);
} else {
if ($response->code == 405) {
throw new APIException('Method Not Allowed', $_httpContext);
} else {
if ($response->code == 410) {
throw new APIException('Resource No Longer Available', $_httpContext);
} else {
if ($response->code < 200 || $response->code > 208) {
//[200,208] = HTTP OK
throw new APIException("HTTP Response Not OK", $_httpContext);
}
}
}
}
}
}
}
$mapper = $this->getJsonMapper();
return $mapper->map($response->body, new Models\GETProductsResponse());
}
示例14: get
public static function get($id, $params = null, $headers = null)
{
$response = Request::get(Rapid::getUrl(self::$route . '/' . $id), $headers, $params);
return Response::make($response);
}
示例15: getCountry
/**
* Show information on a specific country
* @param string $countryCodeA3 Required parameter: The three letter identifier for the country
* @return mixed response from the API call*/
public function getCountry($countryCodeA3)
{
//the base uri for api requests
$queryBuilder = Configuration::BASEURI;
$queryBuilder = Config::get('voxbone.base_uri');
//prepare query string for API call
$queryBuilder = $queryBuilder . '/inventory/country/{countryCodeA3}';
//process optional query parameters
APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('countryCodeA3' => $countryCodeA3));
//validate and preprocess url
$queryUrl = APIHelper::cleanUrl($queryBuilder);
//prepare headers
$headers = array('user-agent' => 'APIMATIC 2.0', 'Accept' => 'application/json');
//prepare API request
$response = Request::get($queryUrl, $headers);
//Error handling using HTTP status codes
if ($response->code < 200 || $response->code > 206) {
//[200,206] = HTTP OK
return $response;
}
return $response->body;
}