Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on get_tag usage (HTML::Toke::Parser)

Status
Not open for further replies.

drimades

IS-IT--Management
Nov 8, 2004
221
0
0
MK
I'm using a script to fetch some news from a website. Follows the main part:
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};
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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top