Thanks for your replies so far.

To mrbbking:

> Do they have any kind of throttle?

The Google API FAQ doesn't mention one, only the 1,000 max queries. I've tried sleeping for 5-10 secs, with no luck.

> Is there something strange about the second word in your list? What happens if you delete the first word from your list and start the process with the second word? Does the first connection still succeed and the second still fail?

It looks like this may be the problem. I took out the first word and immediately got the 500 Error. I've tried messing around with the input encoding parameter, as the second word has got an 'á' in it, but nothing works, even UTF-8.

> The 500 is from Google, right?

Yes.

To Mr. Muskrat:

> Well, you haven't shown us your code that pertains to CGI. So we can't possibly tell you why you're getting a 500 error.

I don't have any CGI code. Here's the code in full (with the Google API key ($key) changed to 0's).
#!/usr/bin/perl use SOAP::Lite; use strict; my $key='00000000000000000000000000'; my $fh = "wordList.txt"; open FH, "$fh" or die "Can't open: $!"; open OUTFILE, ">goodWords.txt"; foreach (<FH>) { chomp; print $_; my $googleSearch = SOAP::Lite -> service("file:GoogleSearch.wsdl") +; my $result = $googleSearch -> doGoogleSearch($key, $_, 0, 10, "fal +se", "", "false", "lang_es", "latin1", "latin1"); my $hitCount = qq{$result->{'estimatedTotalResultsCount'}}; print " returns about $hitCount hits.\n"; if ($hitCount > 200) { print OUTFILE "$_ returns about $hitCount hits.\n"; } } close OUTFILE; close FH;
That's all.

BTW, what's weird about $hitCount, and why is $matchCount better? I'm a total newbie so don't know about these things. :)

As ever, thanks to all the Monks (especially those who've helped me out here).

doonyakka


Update: this particular problem solved, with the very kind help of dree. The problem was not with the code, but with Soap::Lite v0.52. dree had Soap::Lite v0.46 and had no problems running the program, and when he upgraded to v0.52 it stopped working (ie., he got the dreaded 500 error). So, I installed 0.46 and hey presto! it's working fine now. Thanks dree!


In reply to Re: Perl and Google API by doonyakka
in thread Perl and Google API by doonyakka

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.