client::get()
Make an HTTP get request to a URL.
Prototype
response get(string $url, array $options = [])
Parameters
- url - URL to send request to.
- options - Same options as client::Constructor.
Return
A response object is returned. For details, see return for send().
Example
$query = 'SELECT OID, Title FROM HelpDoc';
$url = 'https://demo.webcomand.com/ws/get?query=' . urlencode($query);
$token = 'authentication-token-here';
$response = \io_comand_web\client::get($url, [
'headers' => [
"Authorization: Token $token"
]
]);
if(!$response || !isset($response->info)) {
echo("Unexpected result.\n");
}
echo("Response Payload: " . $response->payload . "\n");
echo("Response HTTP Code: " . $response->info['http_code']);
// if the response was JSON
if(isset($response->data)) {
echo("JSON Data: " . print_r($response->data, TRUE));
}