开发者

Get title from link, PHP Simple HTML DOM Parser

I'm trying to get the title from a link - which I already 开发者_StackOverflow社区have identified, it is just the last bit with retrieving the title from the same link.

To find the right link I use this code:

$html->find('a[href=http://mylink.se']');

But I also want the title from this link. How would I do that?


Assuming you're using PHP Simple HTML DOM parser, which is not clear in your question, you could do

$link = $html->find('a[href=http://mylink.se]', 0); //As the OP pointed out in comments, you need to select the first element
$title = $link->title

http://simplehtmldom.sourceforge.net/manual.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜