实用PHP抓取网页内容测试

01 <html>
02 <head>
03 <title>实用抓取网页内容测试 </title>
04 <meta http-equiv="Content-Type" content="text/html; charset=GB2312">
05 </head>
06 <body>
07 <?php
08 $url='http://localhost/test.php?username=$username&passoword=$password'; //测试本地网页
09 #$url='http://192.168.1.158/sms?username=$username&password=$password; //实际POST url
10 $lines_array=file($url);
11 $lines_string=implode('',$lines_array);
12 eregi("(.*)", $lines_string,$head);
13 echo $head[0];//这可能有时根据需要把post之后返回的参数进行拆分数组之类的一些问题,可以根据要求去实现
14 ?>
15 </body>
16 </html>

http://www.myenjoylife.cn/read.php?109

[ 本帖最后由 hongyu6 于 2008-6-11 15:18 编辑 ]