php curl post ile sonuç elde edemedim bir türlü sebebini de anlayamadım artık yorgunluktan da bitkin düştüm. yardım rica ediyorum.
$data_array = array(
'hash' => $hash,
'querytype' => "alternate",
'type' => "videoGet"
);
// $json = json_encode($data_array);
// $data = array('JSON' => $json);
$body = http_build_query($data_array);
$ch = curl_init();
$url = 'https://site.com/ajax/service';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Host: site.com",
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json, text/javascript, */*; q=0.01",
"Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3",
"Accept-Encoding: gzip, deflate, br",
"X-Requested-With: XMLHttpRequest",
"Origin: https://site.com",
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
"Connection: keep-alive"
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode($body));
$result = curl_exec($ch);
curl_close($ch);
return json_decode(json_encode($result));ya 400 bad requst e düşüyor ya da sonuç vermiyor.