Answer the question
In order to leave comments, you need to log in
Why am I not getting a JSON response when I send a GET request using PHP?
Good afternoon! There is such a site with ads - https://kolesa.kz/a/show/96337478
If you enter such a GET request at the following address using JS/JQuery.
$.get('https://kolesa.kz/a/ajaxPhones/?id=96337478', function(t) {
console.log(t.data.model);
})
function getPhones($id) {
$ch = curl_init('https://kolesa.kz/a/ajaxPhones/?id='.$id);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, false);
$html = curl_exec($ch);
curl_close($ch);
return json_decode($html);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question