作者kornelius (Kornelius)
看板PHP
标题Re: [请益] 远端网页抓取字串的问题
时间Fri May 18 13:31:17 2007
用 http 可以解决
http://www.php.net/manual/en/ref.http.php
CURL 也能解决了,但是如果你不懂原理都是枉然。
http://www.php.net/manual/en/ref.curl.php
不然更低阶一点,用 Socket ...
Socket
http://www.php.net/manual/en/ref.sockets.php
※ 引述《fillmore (.......................)》之铭言:
: 尚未解决
: web server看到的跟你client直接读取网页的结果会不同,不能够叫web server去抓网页
: 结果
恩...帮你抓网页的应该不是叫做 "web server" 的东西吧?
: 读网页 file ("http://url");
file 是会传回阵列,要处理 tag 最好用 file_get_contents
: 至於抓 tag
: strip_tags ( string str [, string allowable_tags] )
strip tags 是用来去除 tag 用的。不是抓 tag.........
: 还有 regular expression
: 自己去研究吧
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.223.99.44
※ 编辑: kornelius 来自: 61.223.99.44 (05/18 13:32)
1F:推 foxzgerald:除了 cli 之外,执行 php 的不就是 server 嘛 :P ? 05/18 13:44
2F:推 fillmore:我不是说不能够抓阿可是抓到的就会不是我想要的了 05/18 13:56
3F:推 kornelius:web server 只负责呈现 php 产生的结果。 05/18 14:08
4F:推 foxzgerald:用 php 写个 client 模拟器放在 server 上 05/18 15:21
5F:→ fillmore:我的确是这样写 05/18 16:11