$uinfo = Parse_url ($url);//Resolve URL address, such as http://111cn.net/archives/1.html if ($uinfo [' path '])// $data = $uinfo [' path '];//here get/archives/1.html Else $data = '/';//default Root if (! $FSP = @fsockopen ($uinfo [' Host '], (($uinfo [' Port '])? $uinfo [' Port ']: "("), $errno, $errstr, 12)) { echo "I'm sorry. The other site is temporarily unable to open, please visit later:". $uinfo [' Host ']; Exit }else{ Fputs ($FSP, "get". $data. " Http/1.0rn ");//If it is a cross station post submission, you can use the Post method Fputs ($FSP, "host:". $uinfo [' Host ']. " RN "); Fputs ($FSP, "referer:111cn.netrn")//Forged Referer Address Fputs ($FSP, "user-agent:mozilla/4.0" (compatible; MSIE 6.0; Windows NT 5.1) rnrn "); $res = '; while (!feof ($FSP)) { $res. =fgets ($FSP, 128); if (Strstr ($res, "OK")) { Header ("Location: $url"); Exit } } } If the 301 or 302 status code can continue processing Return address approximate form: http/1.1 moved permanentlyncontent-length:164ncontent-type:text/htmlnlocation:http://111cn.net/ $arr =explode ("n", $res); $arr =explode (":", $arr [3]);//location behind is true redirect address Header ("Location:". $arr [0]);//Jump Destination Address Exit |