Jump to content

[Inactive] Lwp::useragent Issue


islex

Recommended Posts

Hello

I am on 'stevie' and want to retrieve some data from 'Google - maps.googleapis.com'. I use LWP::UserAgent.

 

From heliohost.org the download works sometimes but most of the times it does not.

The 'response->status_line' is: 500 Can't connect to maps.googleapis.com:80

The strange thing is, when it works at some point it works for a while and then stops working again.

 

With other tested url's it's working without any issues. The url works from the browser and with wget without any problems.

 

The snipplet of the program is:

 

#!/usr/bin/perl -wT

 

use strict;

use warnings;

 

require LWP::UserAgent;

 

print "Content-type: text/html\n\n";

 

my $ua = LWP::UserAgent->new;

$ua->timeout(5);

 

my $response = $ua->get('http://maps.googleapis.com/maps/api/directions/xml?origin=49.29,-123.13&destination=49.32,-123.12');

print $response->status_line;

print "<br>";

 

if ($response->is_success) {

my @googleResponse = $response->decoded_content;

print qq(success<br>);

print qq(@googleResponse);

print "<br>";

} else {

print qq(err_timeout<br>);

}

 

... and its uploaded to: http://islander.heli...gi-bin/test.cgi

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

We've had others report this issue as well. The language or method used to access it doesn't seem to matter. The last user who reported it tried cURL and file_get_contents() in PHP. The issue appears to do with Google services specifically, as other services don't seem to suffer this problem.

 

I'll escalate this for you, but the immediate fix is to use a non-Google service for your data.

Link to comment
Share on other sites

Here's the other thread that wolstech is referencing that is similar to yours: http://www.helionet.org/index/topic/22130-network-error-with-curl-request-to-google-places-api/

 

And here is the post I made there:

Here's the error I get:
 { "error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 65.19.143.2, with empty referer", "html_attributions" : [], "results" : [], "status" : "REQUEST_DENIED" } { "error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 65.19.143.2, with empty referer", "html_attributions" : [], "results" : [], "status" : "REQUEST_DENIED" } 

My guess is that you might have to add Stevie's IP to a safe list of some sort to use that API.

 

What does google support say about this error?

Link to comment
Share on other sites

Thank you for your fast response.

In my earlier post I forgot to mention that I transferred the script from another 'free web hosting' and I never experienced any problems there.

I have not contacted Google support yet but I will do.

Link to comment
Share on other sites

I have not contacted Google support yet but I will do.

Please update this thread to let us know what they have to say about this. As wolstech mentioned it's not just you who has had this issue so it would be nice to know what to tell any users in the future that also come across this same thing. Thanks!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...