Merhabalar, https://www.instagram.com/web/search...uery=instagram direkt girilince sorun yok fakat
curl ile çekilince hata veriyor sebebi ve çözümü nasıl olmalı ?
İnstagram curl hatası
8
●191
- 16-09-2020, 03:52:52Son güncellemelerle Instagram artık CURL erişimlerini kısıtlıyor.ataliemre adlı üyeden alıntı: mesajı görüntüle
- 16-09-2020, 03:55:06Testini yaptım sorunsuz çekiyor
header('Content-type:application/json;charset=utf-8'); function sanitize_output($buffer) { $search = array( '/\>[^\S ]+/s', // strip whitespaces after tags, except space '/[^\S ]+\</s', // strip whitespaces before tags, except space '/(\s)+/s', // shorten multiple whitespace sequences '/<!--(.|\s)*?-->/' // Remove HTML comments ); $replace = array( '>', '<', '\\1', '' ); $buffer = preg_replace($search, $replace, $buffer); return $buffer; } function post_data($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_ENCODING, "gzip, deflate, br"); $return = sanitize_output(curl_exec($ch)); curl_close($ch); return $return; } echo post_data("https://www.instagram.com/web/search/topsearch/?query=instagram"); - 16-09-2020, 04:43:01
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.instagram.com/web/search/topsearch/?query=instagram'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $headers = array(); $headers[] = 'Authority: www.instagram.com'; $headers[] = 'Pragma: no-cache'; $headers[] = 'Cache-Control: no-cache'; $headers[] = 'Upgrade-Insecure-Requests: 1'; $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36'; $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'; $headers[] = 'Sec-Fetch-Site: cross-site'; $headers[] = 'Sec-Fetch-Mode: navigate'; $headers[] = 'Sec-Fetch-User: ?1'; $headers[] = 'Sec-Fetch-Dest: document'; $headers[] = 'Accept-Language: tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7'; $headers[] = 'Cookie: İnstagram Cookie Bilgileriniz'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); echo $result; ?>İnstagram Cookie Bilgileriniz yazan yere instagram cookie bilgilerinizi girip deneyin. - 16-09-2020, 04:56:33Farklı bir link mi kullandın, json çıktı yerine html çıktı vermişataliemre adlı üyeden alıntı: mesajı görüntüle
- 16-09-2020, 14:39:20Bazı instagram apileri böyle çalışıyor eğer cookie yoksa giriş sayfasını yükler.iashiru adlı üyeden alıntı: mesajı görüntüle