we have the following problem. When we try to save some php code which executes a curl request, the interface fails to save the code when we include the "Content-Type: application/json" Header.
Code:
$ch = curl_init();
$post_data = json_encode(array(
"title"=>"Title",
"body"=>"Body",
));
curl_setopt($ch, CURLOPT_URL, "http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
curl_setopt($ch, CURLOPT_HTTPHEADER,
array(
'Origin: http://xx.xxx.x.xxx:yyyy',
'Accept-Encoding: gzip, deflate',
'Accept-Language: en-US,en;q=0.8',
'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
'Content-Type: application/json',
'Accept: application/json, text/plain, */*',
'Referer: http://xx.xxx.x.xxx:yyyy/',
'Connection: keep-alive',
'Dnt: 1');
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
More specifically, we get a 403 error saying "You are not authorized to view this page".
Thanks in advance.