Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$VAR1 = { 'xml_api_reply' => { '-version' => '1', 'weather' => { .... } $VAR1 = { 'xml_api_reply' => { '-version' => '1', 'weather' => { .... } ....
#!/usr/bin/perl -w use strict; use CGI qw(-oldstyle_urls :standard); use XML::TreePP; use XML::XPath; use XML::Simple; use Data::Dumper; use Date::Format; use Date::Parse; my $q = new CGI; $| = 1; my @zipcode = qw(02151 01908 02638 02669 02670 02536 02642 02574 02332 + 02601 02045 01930 02152 27943 02169); my ($currtempf, $currtempc, $currhumidity, $currcondition, $currwind, +$todayhigh, $todaylow, $todaycond, $tomorrowcond); my ($city, $url, $tpp, $tree); #set $Data::Dumper::Purity to 1 if you have nested references $Data::Dumper::Purity = 1; open (FILE, "> data.txt") or die "can't open $tree: $!"; foreach my $zip(@zipcode) { next unless $zip =~ /^(\d{5})$/; $url = "http://www.google.com/ig/api?weather=".$zip ; $tpp = XML::TreePP->new(); $tree = $tpp->parsehttp( GET => $url ); print FILE Dumper($tree); } close FILE or die "can't close $tree: $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Save results into one big XML file help!
by BrowserUk (Patriarch) on Aug 16, 2012 at 03:17 UTC | |
by Anonymous Monk on Aug 16, 2012 at 03:28 UTC | |
by BrowserUk (Patriarch) on Aug 16, 2012 at 03:42 UTC | |
by Anonymous Monk on Aug 16, 2012 at 13:28 UTC | |
by BrowserUk (Patriarch) on Aug 16, 2012 at 14:25 UTC | |
| |
|
Re: Save results into one big XML file help!
by cheekuperl (Monk) on Aug 16, 2012 at 02:58 UTC | |
by roboticus (Chancellor) on Aug 16, 2012 at 13:13 UTC | |
|
Re: Save results into one big XML file help!
by philiprbrenan (Monk) on Aug 29, 2012 at 21:52 UTC |