Hello all,

I've made a spider which gets cookies from web sites, then it sends it back
to the next pages.

The script works for some pages, but for others it gives me the following
error message:

[Thu Nov 21 19:10:31 2002] [error] [client 127.0.0.1] Can't locate object
method "host" via package "URI::_generic" at
C:/Perl/site/lib/HTTP/Cookies.pm line 682.

Please tell me what could be the problem.

Thank you.

The code I've used is:

use strict;
use LWP::UserAgent;
use HTTP::Cookies;
my $ua = LWP::UserAgent -> new (env_proxy => 0,
timeout => 30,
keep_alive => 1,
);

#...

my $cookie_jar = HTTP::Cookies -> new(3, $cookies_file);

my $request = HTTP::Request -> new('GET', $page);
$request -> header('REFERER' => $page);

#Send the cookies to the site:
$cookie_jar -> load($cookies_file);
$cookie_jar->add_cookie_header($request);

my $response = $ua -> request($request);
$cookie_jar->extract_cookies($response);
$cookie_jar->save($cookies_file);

if ($response -> is_success &&
($response -> header("content-type") =~ /text\/html/i
or
$response -> header("Content-type") =~ /text\/plain/i)) {
....




Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to