For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > November 2005 > Google API + SOAP









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Google API + SOAP
Mandar Rahurkar

2005-11-26, 6:56 pm

Hi,
I am using following script to access Google Api however I get the following error :

502 Bad Gateway at ./googly.pl line 15 .

I think the problem is with SOAP::Lite package. Has anyone experience this error before ?

Thanks,
Mandar



#! /ws/ifp-22/scratch/Perl/bin/perl

use SOAP::Lite;

@ARGV == 2 or die "Usage: googly <query> <number of results>\n" ;

my($q, $maxResults) = @ARGV;


$key="-------------------";
# key, q, start, maxResults, filter, restrict, safeSearch,
# lr, ie, oe
my @params = ($key, $q, 0, $maxResults, 0, '', 0, '', 'latin1', 'latin1');

my $result =
SOAP::Lite
-> service("file:GoogleSearch.wsdl")
-> doGoogleSearch(@params);

print join "\n",
map( { qq{<a href="$_->{URL}">} . ($_->{title} ||
$_->{URL}) . qq{</a>
<br />} } @{$result->{resultElements}} );
Rob Coops

2005-11-28, 3:55 am

This seems to have to do with running into a proxy server or being in a NAT
enviroment from my perspective.

This error indicates that your connection to the outside is a little
borked...

I of course can not say for sure as I do nto know your setup but I can say
that I have been able to get this google search working when having a direct
connection to the internet, I personaly have not tried to get it working
over a shielded connection but I guess you will have to look into getting
SOAP::Lite to work with your proxy or your NAT setup.


On 11/26/05, Mandar Rahurkar <rahurkar@uiuc.edu> wrote:
>
> Hi,
> I am using following script to access Google Api however I get the
> following error :
>
> 502 Bad Gateway at ./googly.pl line 15 .
>
> I think the problem is with SOAP::Lite package. Has anyone experience this
> error before ?
>
> Thanks,
> Mandar
>
>
>
> #! /ws/ifp-22/scratch/Perl/bin/perl
>
> use SOAP::Lite;
>
> @ARGV == 2 or die "Usage: googly <query> <number of results>\n" ;
>
> my($q, $maxResults) = @ARGV;
>
>
> $key="-------------------";
> # key, q, start, maxResults, filter, restrict, safeSearch,
> # lr, ie, oe
> my @params = ($key, $q, 0, $maxResults, 0, '', 0, '', 'latin1', 'latin1');
>
> my $result =
> SOAP::Lite
> -> service("file:GoogleSearch.wsdl")
> -> doGoogleSearch(@params);
>
> print join "\n",
> map( { qq{<a href="$_->{URL}">} . ($_->{title} ||
> $_->{URL}) . qq{</a>
> <br />} } @{$result->{resultElements}} );
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com