Apologies to revive an old thread but I've also just run into this issue and I don't have authorisation to modify the server where the API is I require data from. My solution was to run the API call direct from the PHP script and echo the response. I can then 'get' the response using the get object, here is the PHP code:
$url = 'Please login to see this link. to your api';
$headers = array('Content-Type: application/json');
$body = '{
"parameter01": 11,
"parameter02": "200",
"parameter03": "ACC",
"parameter04": 1
}';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if ($response === false) {
die('Error occurred:' . curl_error($ch));
}
curl_close($ch);
// echo response from the server. Tested and works using the get object to retreive the response run from a html page
echo $response;
So yes, in this case instead of trying to access an API directly, my approach was to access the API via the php script and echo the response so the get object can grab it. It seemed to work for me at least! 👍🏻