Why curl can't download this link?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
20 views
$url = 'https://credits-pl.ru/offer/kredit-911/'; $curl = curl_init(); $cookie = __DIR__ .'/cookie/cookie.txt'; $user_agent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"; $headers = [ 'Referer: http://www.google.com/', "User-Agent: $user_agent" ]; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, THIS, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie); curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie); $str = curl_exec($curl);

I go out the response code of the server 200. But the link does not go to redirecton to the end.
Must be parsed page to the host mfc911.ru but the redirect did not reach it. Remains host go.leadgid.ru .
by | 20 views

2 Answers

0 like 0 dislike
if you're interested to experiment with the code some myself!
if the decision - google.com
here the first results of the search
by
0 like 0 dislike
Add the code
curl_setopt($curl, CURLOPT_HEADER, 1);

And it will be clear what is happening.
If the server gave a 200, so he decided that a redirect then you need to do.
by

Related questions

0 like 0 dislike
1 answer
asked Jun 11, 2019 by felsme
0 like 0 dislike
2 answers
asked Apr 28, 2019 by khodos_dmitry
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users