取得面の内容の 1 つの関数
- function getwebdate($url){
- $tmp = str_replace('http://', '', $url);
- $domain = substr($tmp, 0, strpos($tmp, '/' ));
- $path = strstr($tmp, '/');
- $fp = fsockopen($domain, 80, $errno, $errstr, 30);
- if (!$fp) {
- echo "$errstr ($errno)
n";
- } else {
- $out = "GET $path HTTP/1.1rn";
- $out .= "ホスト: {$domain}rn";
- //$ out .= "リファラー: {$url}rn";
- $out .= "接続: Closernrn";
-
- fwrite($fp, $out);
- while (!feof($fp)) {
- $html . = fgets($fp, 128);
- }
- fclose($fp);
- return substr(strstr($html, "rnrn"), 4);
- }
- }
复制代
|