網頁抓取區段文字 [php]

今天公司長官提出需要把一些及時的新聞顯示在網頁上,

因此研究了一下把動態網頁訊息顯示在自己blog的方法,

提供各位參考囉~



$http=" 網址 ";            
$buffer = file($http);             //將網址讀入buffer變數
for($i=0;$i<sizeof($buffer);$i++)  //將每段文字讀出來,以換行為單位,sizeof會傳回共有幾筆
{
$n1=strpos($buffer[$i]," ooxx ");  //抓出資料所在位置

$a=substr($buffer[$i],$n1,10);     //n1後10個字元
$a=iconv("UTF-8","big5",$a);       //utf-8 轉 big5

echo $a."<br>";

COMMENTS

名稱

音樂,11,音樂-木吉他演奏曲,9,音樂-教學,8,音樂-電吉他演奏,3,音樂-彈唱譜(含歌詞),21,音樂-課程,2,音樂-獨立樂團譜,36,音樂-Chords,75,音樂-Cover,11,音樂-GP譜,19,音樂-ギターコード譜,6,音樂創作編曲,12,食記-台中,3,食記-台北市,22,食記-台南,1,食記-桃園,1,食記-高雄,2,食記-新竹,1,食記(出國去)-大陸湖西,1,食記(出國去)-日本東京,2,食記推薦,9,烏克麗麗,1,遊記-台中,1,遊記-台北市,2,遊記-花蓮,1,遊記-桃園,1,遊記-新北市,1,遊記(出國去)-大陸湖西,1,遊記推薦,8,歌詞翻譯,6,懶人包,1,
ltr
item
《吉他日誌 OGD Studio》 高雄吉他教學 一對一、團體班、視訊課程: 網頁抓取區段文字 [php]
網頁抓取區段文字 [php]
《吉他日誌 OGD Studio》 高雄吉他教學 一對一、團體班、視訊課程
https://trevorsguitar.blogspot.com/2018/09/php.html
https://trevorsguitar.blogspot.com/
http://trevorsguitar.blogspot.com/
http://trevorsguitar.blogspot.com/2018/09/php.html
true
6174825709949005331
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content