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:
My Perl Script:
Any ideas what might be wrong and how to fix it?
Best Regards,
Ritter