0
首先,我的PHP技能并不好。我想列出,看起来像这样所有链接:PHP preg_match列表链接
<a href="..." class="bokstav">...</a>
从网站:
file_get_contents('.....');
我怎样才能找到的preg_match或这样这些链接?
/TB
首先,我的PHP技能并不好。我想列出,看起来像这样所有链接:PHP preg_match列表链接
<a href="..." class="bokstav">...</a>
从网站:
file_get_contents('.....');
我怎样才能找到的preg_match或这样这些链接?
/TB
这是一个与phpQuery或QueryPath简单:
$html = file_get_contents($url);
$qp = qp($html);
foreach ($qp->find("a.bokstav") as $a) {
print $a->attr("href");
}
如果你想用的preg_match来试试吧,看看http://www.regular-expressions.info/examples.html或https://stackoverflow.com/questions/89718/is-there-anything-like-regexbuddy-in-the-open-source-world上手。
改为使用DomDocument(使用loadHTML()方法)。 – arnaud576875 2011-02-02 19:12:47