мой код не отображает заголовок скриншота ('Content-Type: image / png');
$url = 'https://www.google.com/';
//API Url
$url2 = 'http://api.site:port/screenshot';
//Initiate cURL.
$ch = curl_init($url2);
//The JSON data.
$jsonData = array(
'url' => $url
);
//Encode the array into JSON.
$jsonDataEncoded = json_encode($jsonData);
//Tell cURL that we want to send a POST request.
curl_setopt($ch, CURLOPT_POST, 1);
//Attach our encoded JSON string to the POST fields.
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
//Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('content-type: application/json'));
//Execute the request
$result = curl_exec($ch);
curl_close($ch);
Я тестировал на почтальоне, это правильно, но не на php / json какие-либо идеи?