Re: [請益] 遠端網頁抓取字串的問題

看板PHP作者 (Kornelius)時間18年前 (2007/05/18 13:31), 編輯推噓4(401)
留言5則, 3人參與, 最新討論串5/15 (看更多)
用 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)

05/18 13:44, , 1F
除了 cli 之外,執行 php 的不就是 server 嘛 :P ?
05/18 13:44, 1F

05/18 13:56, , 2F
我不是說不能夠抓阿可是抓到的就會不是我想要的了
05/18 13:56, 2F

05/18 14:08, , 3F
web server 只負責呈現 php 產生的結果。
05/18 14:08, 3F

05/18 15:21, , 4F
用 php 寫個 client 模擬器放在 server 上
05/18 15:21, 4F

05/18 16:11, , 5F
我的確是這樣寫
05/18 16:11, 5F
文章代碼(AID): #16JJec-6 (PHP)
討論串 (同標題文章)
文章代碼(AID): #16JJec-6 (PHP)