I'm using a script to fetch some news from a website. Follows the main part:
with this I manage to get the web address (href) and the text between <a> and </a>. It seems that when I call $stream->get_trimmed_text('/a') it moves already over </a>. So when I call the last lines, it gets the <img> after </a> and not the one placed in <a ...><img ...></a>, which I actually want to get. Is there any unget_tag or anything else to move back in the stream?
Code:
$tag = $stream->get_tag('a');
if ($tag->[1]{class} eq 'font12' || $tag->[1]{class} eq 'font5') {
$url = $tag->[1]{href};
$headline = $stream->get_trimmed_text('/a');
$tag = $stream->get_tag('img');
$pic = $tag->[1]{src};