【发布时间】:2011-10-27 20:06:09
【问题描述】:
我有html:
<hr>
<p><font face="AvantGarde Bk BT" style="font-size: 9pt" color="#66FF33">
(08/04/2006) Parallel Worlds are one of the featured artists in the
<a href="http://www.urband.net/radio/">Urban D radio</a>. there you can listen
to many tracks from the 3 released cd albums.</font></p>
<hr>
我需要得到
1:(08/04/2006) Parallel Worlds are one of the featured artists in the
2:. there you can listen to many tracks from the 3 released cd albums.
我使用http://simplehtmldom.sourceforge.net。
我得到元素 $e->href 这是<a href="http://www.urband.net/radio/">Urban D radio</a>
【问题讨论】:
-
$font_content = preg_match('/<font face="AvantGarde Bk BT"[^>]*>([\s\S]+?)</font>/', html)$text = preg_replace('/<a[^>]+>[^<]*</a>/', '', $font_content) -
@Aamir Adnan,不!我刚让自己不要使用正则表达式
标签: php html-parsing web-scraping