package GoogleCampaignData;
use HTML::TableExtract;
use LWP::UserAgent;
use HTTP::Request::Common;
use strict;
sub new {
my ($class, $campid) = @_;
my $self = {};
_init($self, $campid);
bless($self, $class);
return $self;
}
sub _init {
my ($self, $campid) = @_;
my $ua = LWP::UserAgent->new;
$ua->env_proxy;
my $req =
$ua->request(POST "https://adwords.google.com/reports/ads",
[
# "seshid" => "XXXXXX", # hidden
"campaign" => $campid,
"when" => "campaignlife", # campaign to date
"mode" => "keywords", # by keyword URL -- this is critical
"keywords_criteriaSort" => "parameters", # by keyword
"byposition" => "1", # differentiate pos1 and pos2
"display_format" => "html", # HTML results
"submit2" => "Generate Report" # do it
],
Referer => "http://ads.google.com/reports/ads?username=XXXX&password=XXXX",
);
my $content = $ua->request($req)->as_string;
die $content; # FOR DEBUGGING -- SHOW WE GOT SOMETHING
}
1;