After writing the cURL script to to get what I wanted - I found out that the web server doesn't support cURL and only supports pure PHP. How would I go about doing this in pure PHP?
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($ch);
$json = $server_output;
$data = json_decode($json);
Is what has managed to work for me.
I have tried this approach for pure PHP:
// Create a stream
$opts = [
"http" => [
"method" => "GET",
"header" => "Header1: Header1Input" .
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents('https://xx.xxxx.xxx/xxx/blog/micro', false, $context);
$file = json_decode($file);
However I get this error:
failed to open stream: HTTP request failed!