#! /usr/bin/perl use warnings; use strict; use 5.010; use WWW::Mechanize::GZip; use HTML::TableExtract qw(tree); my $site = 'http://www.fourmilab.ch/yoursky/cities.html'; my $mech = 'WWW::Mechanize::GZip'->new; $mech->get($site); $mech->follow_link( text => 'Portland OR' ); my $lub = 2457204.63659; #least upper bound my $glb = 2457207.63659; #greatest lower bound say $mech->dump_forms; $mech->set_fields( qw'date 2'); my $guess = median( $lub, $glb); say "guess is $guess"; $mech->set_fields( jd => $guess ); $mech->click_button(value => "Update"); say $mech->dump_forms; my $te = 'HTML::TableExtract'->new; $te->parse($mech->content); my $table = ($te->tables)[3]; my $table_tree = $table->tree; my $table_text = $table_tree->as_text; say "table text is $table_text"; my $venus = $table_tree->cell(4,1)->as_text; say "say venus is $venus"; my $jupiter = $table_tree->cell(7,1)->as_text; say "say jupiter is $jupiter"; sub median{ my ($upper, $lower) = @_; my $return = ($upper+$lower)/2.0; return $return; } #### POST http://www.fourmilab.ch/cgi-bin/Yoursky [request] =Update (submit) date=0 (radio) [*0/Now|1/Universal time:|2/Julian day:] utc=2015-06-18 23:44:00 (text) jd=2457192.48889 (text) lat=45°31'5" (text) ns=North (radio) [*North|South] lon=122°40'33" (text) ew=West (radio) [East|*West] coords=on (checkbox) [/off|*on/Ecliptic and equator] moonp=on (checkbox) [/off|*on/Moon and planets] deep=on (checkbox) [/off|*on/Deep sky objects of magnitude] deepm=2.5 (text) consto=on (checkbox) [/off|*on/Outlines] constn=on (checkbox) [/off|*on/Names] consta= (checkbox) [*/off|on/aligned with horizon?] consts= (checkbox) [*/off|on/abbreviate?] constb=on (checkbox) [/off|*on/Boundaries Stars: Show stars brighter than magnitude] limag=5.5 (text) starn=on (checkbox) [/off|*on/Names for magnitude] starnm=2.0 (text) starb=on (checkbox) [/off|*on/Bayer/Flamsteed codes for mag.] starbm=2.5 (text) flip= (checkbox) [*/off|on/Invert North and South Image size:] imgsize=640 (text) fontscale=1.0 (text) scheme=0 (option) [*0/Colour|1/Black on white background|2/White on black background|3/Night vision (red)] edump= (checkbox) [*/off|-xe/Echo elements] elements= (textarea) guess is 2457206.13659 POST http://www.fourmilab.ch/cgi-bin/Yoursky [request] =Update (submit) date=2 (radio) [0/Now|1/Universal time:|*2/Julian day:] utc=2015-07-02 15:16:41 (text) jd=2457206.13659 (text) lat=45° (text) ns=North (radio) [*North|South] lon=122° (text) ew=West (radio) [East|*West] coords=on (checkbox) [/off|*on/Ecliptic and equator] moonp=on (checkbox) [/off|*on/Moon and planets] deep=on (checkbox) [/off|*on/Deep sky objects of magnitude] deepm=2.5 (text) consto=on (checkbox) [/off|*on/Outlines] constn=on (checkbox) [/off|*on/Names] consta= (checkbox) [*/off|on/aligned with horizon?] consts= (checkbox) [*/off|on/abbreviate?] constb=on (checkbox) [/off|*on/Boundaries Stars: Show stars brighter than magnitude] limag=5.5 (text) starn=on (checkbox) [/off|*on/Names for magnitude] starnm=2.0 (text) starb=on (checkbox) [/off|*on/Bayer/Flamsteed codes for mag.] starbm=2.5 (text) flip= (checkbox) [*/off|on/Invert North and South Image size:] imgsize=640 (text) fontscale=1.0 (text) scheme=0 (option) [*0/Colour|1/Black on white background|2/White on black background|3/Night vision (red)] edump= (checkbox) [*/off|-xe/Echo elements] elements= (textarea) table text is  RightAscensionDeclinationDistance(AU)From 45°N 122°W:AltitudeAzimuthSun6h 45m 22s+23° 1.5'1.01727.248−96.154UpMercury5h 17m 22s+21° 6.7'1.00041.481−78.217UpVenus9h 39m 50s+14° 20.7'0.504−8.079−119.724SetMoon19h 13m 12s−17° 26.2'58.8 ER−18.65783.705SetMars6h 23m 45s+24° 5.1'2.58531.733−93.449UpJupiter9h 38m 6s+15° 1.7'6.094−7.283−119.835SetSaturn15h 49m 5s−17° 53.4'9.200−53.265127.849SetUranus1h 15m 51s+7° 19.6'20.14051.60213.737UpNeptune22h 46m 15s−8° 39.6'29.43222.30450.179UpPluto19h 0m 30s−20° 42.1'31.888−23.07383.256Set say venus is 9h 39m 50s say jupiter is 9h 38m 6s