Re: [請益] 讀取外部網頁的表格文字內容
※ 引述《MapleWang8 (瘋子谷待太久.....)》之銘言:
: : 推 bigair:file_get_contents, curl, preg_match 01/14 20:38
: 我能用file_get_contents或curl去捉取來源檔案了
: 可是捉回來的.htm檔
: 要如何分析
: 把<table>中間的第一欄、第二欄.....取出來呢?
function get_between ($text, $s1, $s2) {
$mid_url = "";
$pos_s = strpos($text,$s1);
$pos_e = strpos($text,$s2);
for ( $i=$pos_s+strlen($s1) ; ( ( $i < ($pos_e)) && $i < strlen($text) ) ; $i++ ) {
$mid_url .= $text[$i];
}
return $mid_url;
}
好像是在 php.net 裡看到的~覺得滿好用的
我寫了個簡單的試範~
Demo URL: http://3wa.tw/demo/get_between.php
--
3WA訓練家的工作室
宗旨:諸葛單中,謝謝
個人佈弱格 網址:http://3wa.tw
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.240.83.12
推
01/17 23:44, , 1F
01/17 23:44, 1F
→
01/17 23:44, , 2F
01/17 23:44, 2F
→
01/17 23:44, , 3F
01/17 23:44, 3F
→
01/18 00:50, , 4F
01/18 00:50, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
6
14