I tried almost all sets of options for a kurla ... There is a link ... The page really exists ... but CURL does not see it ...

ini_set('allow_url_fopen','on'); set_time_limit(0); $uagent = "Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.14"; $Link = ' https://euroset.ru/kazan/search/?q=LG+G360&filter=all&filter%5B%5D=products '; $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // возвращает веб-страницу curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0); // не переходит по редиректам curl_setopt($curl, CURLOPT_HEADER, 0); // не возвращает заголовки curl_setopt($curl, CURLOPT_URL, $Link); curl_setopt($curl, CURLOPT_TIMEOUT, 120); curl_setopt($curl, CURLOPT_USERAGENT, $uagent); $str = curl_exec($curl); curl_close($curl); echo $str;</code></pre> 

ini_set('allow_url_fopen','on'); set_time_limit(0); $uagent = "Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.14"; $Link = ' https://euroset.ru/kazan/search/?q=LG+G360&filter=all&filter%5B%5D=products '; $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // возвращает веб-страницу curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0); // не переходит по редиректам curl_setopt($curl, CURLOPT_HEADER, 0); // не возвращает заголовки curl_setopt($curl, CURLOPT_URL, $Link); curl_setopt($curl, CURLOPT_TIMEOUT, 120); curl_setopt($curl, CURLOPT_USERAGENT, $uagent); $str = curl_exec($curl); curl_close($curl); echo $str;</code></pre>

Well, what did I do wrong again ???

    2 answers 2

    You need to add the ability to navigate through redirects by setting the curl options:

     curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_MAXREDIRS, 5); 

      There are 302 redirects, and you have set not to follow redirects. Change this flag and it will work.

       curl -L https://euroset.ru/kazan/search/?q=LG+G360&filter=all&filter%5B%5D=products 

      Gives page without problems