- $lines = file('http://bbs.it-home.org/');
- foreach ($lines as $line_num => $line) {
- echo "Line {$line_num} : " . htmlspecialchars($line) . "
\n"; - }
- ?>
复制代码2,获取网页的标题: - $url = 'http://bbs.it-home.org';
- $lines_array = file($url);
- echo $lines_array;
- echo "
"; - $lines_string = implode('', $lines_array);
- eregi("", $lines_string, $head);
- echo "head:".$head;
- echo "
"; - print_r($head);
- echo "
"; - echo "title:".$head[1];
- ?>
复制代码 |