查看文章 |
使用php获取网页内容
2008-01-13 15:11
我的 手工艺小站
header("Content-type: text/html; charset=utf-8"); 1$xhr = new COM("MSXML2.XMLHTTP"); 2。file_get_contents实现 <?php 3。fopen()实现 <?if ($stream = fopen('http://www.sohu.com', 'r')) { // print all the page starting at the offset 10 echo stream_get_contents($stream, -1, 10); fclose($stream); } if ($stream = fopen('http://www.sohu.net', 'r')) { // print the first 5 bytes echo stream_get_contents($stream, 5); fclose($stream); } ?> |
最近读者:

