我想索引一个网站,我的preg_match返回一个空数组。使用preg_match索引
这是我到目前为止有:
$content = get_content("www.something.com");
preg_match_all('#<span class="box_cod">Cod: ([0-9\.]*)</span><span class="box_pret">PRET: (.*)</span>#',$content,$Produs);
凡get_content是卷曲功能检索站点。
谢谢!
用正则表达式解析HTML非常困难。你有没有考虑过使用真正的DOM解析器? – 2013-03-04 12:38:17
优秀...另一个机会告诉某人[托尼小马](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 )!我永远不会厌倦这一点。 – SDC 2013-03-04 12:49:07