Hello,
I am trying to search Google using Custom Search API with the following
Perl script. Strangely, the response with the script is [403 Forbidden]
while
the same request over the GUI (Google APIs Explorer/CustomSearch
API/search.cse.list) pass through.
Here is the script:
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Google::CustomSearch;
use Data::Dumper;
my $api_key = '{HERE_IS_MY_API_KEY}';
my $cx = '{MY_custom_search_engine_ID}';
my $filter = '0';
my $country = 'de';
my $engine = WWW::Google::CustomSearch->new(cx => $cx, filter => $filter,
gl => $country, api_key => $api_key);
#print Dumper(\$engine);
my $result = $engine->search('Linux');
print Dumper(\$result);
my $page = $result->request;
my $another = $page->fetch;
Comparing both search strings (search.cse.list and the one generated by my
script) are almost the same (apart from some additional parameters which
are not relevant). The search strings are:
*search.cse.list:*
https://www.googleapis.com/customsearch/v1?q=Linux&cx={MY_custom_search_engine_ID}&filter=0&gl=de&num=10&safe=off&start=1&key={YOUR_API_KEY}
*My Perl Script:*
https://www.googleapis.com/customsearch/v1?key={HERE_IS_MY_API_KEY}&cx={MY_custom_search_engine_ID}&prettyprint=true&alt=json&safe=off&num=10&start=1&filter=0&q=Linux
Any ideas what might be wrong and how to fix it?
Best Regards,
Ritter
--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
To view this message on the web, visit
https://groups.google.com/d/msgid/google-ajax-search-api/86a789d1-c0f6-4eb1-a8bf-5457a54dd668%40googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.