Posted on 2007-02-10 23:09
pts 阅读(5275)
评论(1) 编辑 收藏
简单的做法:
<?php
$url="http://www.blogjava.net/pts";
echo file_get_contents( $url );
?>
或者:
<?
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);
}
?>
但是如果将url换成自己的bolg时,返回的中文显示为乱码?
powered by performancing firefox