- //PHP(前提是装了curl):
- $ch = curl_init();
- curl_setopt ($ch, CURLOPT_URL, "http://www.xxx/");
- curl_setopt ($ch, CURLOPT_REFERER, "http://www.xxx/");
- curl_exec ($ch);
- curl_close ($ch);
-
- //PHP(不装curl用sock)
- $server = 'blog.qita.in';
- $host = 'blog.qita.in';
- $target = '/xxx.asp';
- $referer = 'http://blog.qita.in/'; // Referer
- $port = 80;
- $fp = fsockopen($server, $port, $errno, $errstr, 30);
- if (!$fp)
- {
- echo "$errstr ($errno)
n";
- }
- else
- {
- $out = "GET $target HTTP/1.1rn";
- $out .= "Host: $hostrn";
- $out .= "Cookie: ASPSESSIONIDSQTBQSDA=DFCAPKLBBFICDAFMHNKIGKEGrn";
- $out .= "Referer: $refererrn";
- $out .= "Connection: Closernrn";
- fwrite($fp, $out);
- while (!feof($fp))
- {
- echo fgets($fp, 128);
- }
- fclose($fp);
- }
复制代码
|