Hi all,
I am trying to get json data from an API-set, and the code I got from the API-provider is like this:
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';
$request = new Http_Request2('https://api.example.link/972412112');
$url = $request->getUrl();
$headers = array(
// Request headers
'Authorization' => 'Token YOUR_TOKEN',
'Accept' => 'application/json',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
);
$url->setQueryVariables($parameters);
$request->setMethod(HTTP_Request2::METHOD_GET);
// Request body
$request->setBody("{body}");
try
{
$response = $request->send();
echo $response->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}
?>
I do not get any data in return.
Can You please guide me?
Best regards and thank You.