$header[] = ' accept:image/gif, Image/x-xbitmap, Image/jpeg, Image/pjpeg, Application/x-shockwave-flash, text/html, * '. '/* '; $header[] = ' ACCEPT-LANGUAGE:ZH-CN '; $header[] = "user-agent:mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) gecko/20100101 firefox/25.0 "; $ch= Curl_init ();// page redirection after initializing curl//Allow curl to commitcurl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_followlocation, 1); //returns the header after Curl is committedcurl_setopt ($ch, Curlopt_header, 1); //Recursive fetch locationcurl_setopt ($ch, Curlopt_followlocation, 1); //above processing redirectioncurl_setopt ($ch, Curlopt_url,$url);//Set up linkscurl_setopt ($ch, Curlopt_ssl_verifypeer,FALSE);//HTTPS must be set without authenticationcurl_setopt ($ch, Curlopt_ssl_verifyhost,FALSE);//HTTPS must be set without authenticationcurl_setopt ($ch, Curlopt_returntransfer,TRUE);//set whether to return informationcurl_setopt ($ch, Curlopt_httpheader,$header);//Set HTTP Headers$html= Curl_exec ($ch);//Receive return informationCurl_close ($ch);
The above describes a section of Phpcurl code, including the content of Web redirection, I hope that the PHP tutorial interested in a friend helpful.