-- 
And another question... Are you using any proxy in your broswer? If you
do, how did you imnplemented that proxy in LWP::Simple?

Olivier


Olivier <o...@banyan.cs.ait.ac.th> writes:

> Mike <te...@mflan.com> writes:
>
>> Thanks for the response.
>>
>> I agree with everything you say.
>> I just want my LWP::Simple to access every
>> web link that my browser can access.
>>
>>
>> I now know that some of you can run the
>> code below and get all 4 of the websites
>> I have listed to return the website info.
>> All 4 of those web links gives:
>> "Unable to get page at httpfetch.pl line 21."
>>
>> I can see I am not alone in having this problem.
>> Others have had the same problem with only a few
>> web links.
>
> I don't see why you have a 'die at line 21' while your script has way
> less than 21 lines. Also, the script comes all mangled by the mail, so
> one cannot say if the error is yours or the mailer.
>
> Make your script simple first, so you can confirm your environment is
> working:
>
> #!/usr/bin/perl
> use LWP::Simple;
> $test=get('https://google.com');
> print $test;
>
> When that is working, start changing things one at a time and check at
> each stage that it is still working.
>
> You may also explore the documentation of LWP::Simple to get an error
> message that makes sense, because what you get so far is only 'it does
> not work', one cannot make a diagnostic with that only.
>
> Good luck,
>
> Olivier
>
>>
>>
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>> use LWP::Simple;
>>
>>
>> # Does not work
>>
>> my $test = get('https://nationalmap.gov/epqs/pqs.php') or die 'Unable to 
>> get page'; # Does not work
>> #my $test = get('http://www.wrh.noaa.gov/zoa/mwmap3.php?map=usa') or die 
>> 'Unable to get page'; # Does not work
>> #my $test = get('http://www.glorecords.blm.gov/') or die 'Unable to get 
>> page'; # Does not work
>> #my $test = get('https://glorecords.blm.gov/default.aspx') or die 
>> 'Unable to get page'; # Does not work
>>
>>
>> print "\nAll done.\n\n\$test = $test\n\n";
>>
>>
>> __END__
>>
>>
>>
>> On 8/28/2019 10:00 PM, Olivier wrote:
>>> Mike <te...@mflan.com> writes:
>>>
>>>> Thanks for the response.
>>>>
>>>> Yeah, I don't understand why
>>>> https://nationalmap.gov/epqs/pqs.php
>>>> won't open in a browser, but
>>> In fact, it does open in a browser and the result is "General failure:
>>> Invalid Coordinates".
>>>
>>> This URL runs the PHP script pqs.php, this script needs input
>>> coordinates, if there is no coordinates supplied, this script returns
>>> the message about invalid coordinates.
>>>
>>> This message is not a message from your browser, it is not a message
>>> from the web server, it is a message from pqs.php. Your browser and the
>>> web server are just fine.
>>>
>>> And frankly speaking, what result are you expecting? pqs.php is a script
>>> that returns some data depending on the input data you give. You give no
>>> input, you get no output.
>>>
>>>> https://nationalmap.gov/epqs/
>>>> will.  I imagine this may have something
>>>> to do with redirects, but who knows.
>>> This URL is missing the filename part (after the last /), in that case,
>>> the web server uses a default file (depending on the configuration of
>>> the web server) and the default file is presenting a page that asks for
>>> coordinates.
>>>
>>> So you are asking 2 differents URL, that corresponds to two different
>>> pages, each page giving the correct result.
>>>
>>>> When I put
>>>> https://nationalmap.gov/epqs/pqs.php
>>>> into a web browser it says:
>>>> General failure: Invalid Coordinates
>>>>
>>>>
>>>> When I put
>>>> http://ned.usgs.gov/epqs/pqs.php
>>>> into a web browser it says the same exact thing.
>>> And it is expected that the URL with http and with https give the same
>>> correct result.
>>>
>>>> When I go to
>>>> https://nationalmap.gov/epqs/
>>>> and put -90.76983 for X
>>>> and put 38.72360 for Y
>>>> and hit "Get Elevation"
>>>> it gives:
>>>>
>>>> <USGS_Elevation_Point_Query_Service>
>>>>     <Elevation_Query x="-90.76983" y="38.72360">
>>>>       <Data_Source>3DEP 1/3 arc-second</Data_Source>
>>>>       <Elevation>583.54</Elevation>
>>>>       <Units>Feet</Units>
>>>>     </Elevation_Query>
>>>> </USGS_Elevation_Point_Query_Service>
>>>>
>>>>
>>>>
>>>> When I go to:
>>>> https://nationalmap.gov/epqs/pqs.php?x=-90.76983&y=38.72360&units=feet&output=xml
>>>> it gives:
>>>>
>>>> <USGS_Elevation_Point_Query_Service>
>>>>     <Elevation_Query x="-90.76983" y="38.72360">
>>>>       <Data_Source>3DEP 1/3 arc-second</Data_Source>
>>>>       <Elevation>583.54</Elevation>
>>>>       <Units>Feet</Units>
>>>>     </Elevation_Query>
>>>> </USGS_Elevation_Point_Query_Service>
>>>>
>>>> So that works.
>>> It works because you are providing correct input.
>>>
>>> Best regards,
>>>
>>> Olivier
>>>
>>>> Mike
>>>>
>>>>
>>>>
>>>> On 8/26/2019 10:26 PM, Uri Guttman wrote:
>>>>> have you tried to just telnet to those hosts?
>>>>>
>>>>>   telnet nationalmap.gov:443
>>>>> telnet: could not resolve nationalmap.gov:443/telnet: Name or service
>>>>> not known
>>>>> telnet ned.usgs.gov:443
>>>>> telnet: could not resolve ned.usgs.gov:443/telnet: Name or service not
>>>>> known
>>>>>
>>>>>
>>>>> so there is something wrong with the urls and not the code (or the
>>>>> code has bad urls).
>>>>>
>>>>> and just getting the web pages is also failing
>>>>>
>>>>> GET https://ned.usgs.gov/epqs/pqs.php
>>>>> <error>General failure: Invalid Coordinates</error>
>>>>>
>>>>> GET https://nationalmap.gov/epqs/pqs.php
>>>>> <error>General failure: Invalid Coordinates</error>
>>>>>
>>>>> i dunno the module but it seems that you may not be passing in any
>>>>> coordinates or something else is needed.
>>>>>
>>>>> uri
>>>>>
>>
>>
>>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to