I want to parse the site using Kurla. But the result is an error 302 Found nginx. Here is the code: function curl ($ url)
{ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, " Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0 .2564.109 Safari/537.36"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); $output = curl_exec($ch); curl_close($ch); return $output; } $auth = curl($link ); $parser = phpQuery::newDocument($auth); echo $parser;
What's the mistake? Thanks.