http://www.perlmonks.org?node_id=150570

nop has asked for the wisdom of the Perl Monks concerning the following question:

I am using Randal's form ripper script
(http://www.stonehenge.com/merlyn/WebTechniques/col43.html )
to pull some data from GoogleAds then extract data from the HTML using HTML::TableExtract.
I am NOT an expert in LWP, but I've used Randal's script successfully elsewhere.
Now I am befuddled.
I think I am running into problems as the page uses HTTPS vs. HTTP.
Here's the error I'm encountering:
C:\Inetpub\wwwroot\google\GoogleTools>perl gt_refresh.pl Can't locate object method "method" via package "HTTP::Headers" (perha +ps you for got to load "HTTP::Headers"?) at C:/Perl/site/lib/HTTP/Mes +sage.pm line 189.
And here's my code:
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 critic +al "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=XX +XX&password=XXXX", ); my $content = $ua->request($req)->as_string; die $content; # FOR DEBUGGING -- SHOW WE GOT SOMETHING } 1;
nop

Replies are listed 'Best First'.
Re: https and webtechniques #43
by ellem (Hermit) on Mar 09, 2002 at 23:53 UTC
    I don't mean to be a tool here but the error message says:

    Can't locate object method "method" via package "HTTP::Headers" (perhaps you for got to load "HTTP::Headers"?)

    And I don't see that anywhere. Is it possible that simple?
    --
    ellem@optonline.net
    There's more than one way to do it, just don't use my way.
Re: https and webtechniques #43
by steves (Curate) on Mar 09, 2002 at 17:05 UTC

    ... and OpenSSL I assume.

    What platform? I've had https problems on Solaris 2.7. From what I've found so far I can't just use the latest triplet of LWP::UserAgent/Crypt::SSLeay/OpenSSL. I've managed to get a set of these three that work okay together, but each one is several versions off the latest. I got various errors when they weren't happy.

    I tried this a few months ago though. Since then, a friend of mine says he has gotten all three latest versions to work together. And from posts I read on the libwww mailing list this was only a problem on Solaris for some reason.

Re: https and webtechniques #43
by drifter (Scribe) on Mar 10, 2002 at 10:30 UTC
    I would try to use Net::SSLeay instead.
    Afaik Crypt::SSLeay has had some difficulties with certain certificates, but I won't confirm theyse rumours.
    Also, while Crypt::SSLeay is basically just a "glue" between OpenSSL and perl, whereas Net::SSLeay is a bit better wrapper.
    Just my 5 cents...
Re: https and webtechniques #43
by nop (Hermit) on Mar 09, 2002 at 15:06 UTC
    PS I have crypt-ssleay installed.