i get no result? No error, no feedback...just nothing. What's wrong? How can I debug this?
When I run this CURL in console, everything is okay.
PHP 7.4.21
$response = get_curlresult();
$resArr = array();
$resArr = json_decode($response);
echo "<pre>"; print_r($resArr); echo "</pre>";
function get_curlresult() {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.lorem.ipsom');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$headers = array();
$headers[] = 'Host: api.ipsum.com';
$headers[] = 'Cookie: ASP.NET_SessionId=fsdflkj34jlka';
$headers[] = 'Accept: application/json';
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
return $result;
}
Console cmd:
curl -H "Host: api.ipsum.com" -H "Cookie: ASP.NET_SessionId= fsdflkj34jlka" -H "accept: application/json" -H "content-type: application/json" --compressed "https://www.lorem.ipsom"