CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [sertomallo] Extract data from webpage: Edit Log



Kenosis
User

Mar 25, 2013, 3:23 PM


Views: 542
Re: [sertomallo] Extract data from webpage

Perhaps the following will be helpful:


Code
use strict; 
use warnings;
use LWP::Simple;
use Mojo::DOM;

my $html = get 'http://finanza-mercati.ilsole24ore.com/fcxp?page=BodyListinoCambiMinori&cmd=framexplane&chId=70&RatPageName=N24:finanza-e-mercati:valute:valute-minori&RatHier1=N24,finanza-e-mercati,valute,valute-minori&RatType=N24:finanza-e-mercati:default&RatEvents=';
my $dom = Mojo::DOM->new($html);
my $b = $dom->at('#PRFX_!EUR/DZD_FixingUICPrec');
print $b->text


Output:


Code
102.179


The table at that page is actually within a frame, that frame's contents coming from the url above. Mojo::DOM is used to parse the html, looking for the text in the span whose id is PRFX_!EUR/DZD_FixingUICPrec, which is associated with "UIC-DZD-Dinaro Algerino."


(This post was edited by Kenosis on Mar 25, 2013, 3:26 PM)


Edit Log:
Post edited by Kenosis (User) on Mar 25, 2013, 3:24 PM
Post edited by Kenosis (User) on Mar 25, 2013, 3:25 PM
Post edited by Kenosis (User) on Mar 25, 2013, 3:26 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives