Priebe, Jason said...
>
>I'm trying to retrieve this URL:
>
>http://ads.bfast.com/clients/etoys/dot_clear.gif
>
>and I get a 404.
>
>Netscape Navigator can pull it up fine, but LWP can't, and
>neither can I pull it up with a manual telnet to the host.
>I thought that maybe the server is doing some sort of filtering
>based on User-Agent, but then I tried to mimic Navigator using
>this request:
>
>----------------------------------------------------------------------
>GET /clients/etoys/dot_clear.gif HTTP/1.0
>User-Agent: Mozilla/4.61 [en] (WinNT; I)
>Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
>Accept-Encoding: gzip
>Accept-Language: en
>Accept-Charset: iso-8859-1,*,utf-8
>
>----------------------------------------------------------------------
>
>and it still doesn't work.  Does anybody have an idea as to
>what might be happening here?
>

I get it just fine. From the command line:
        lwp-request 'http://ads.bfast.com/clients/etoys/dot_clear.gif' > dot_clear.gif

does the job or 

use strict;
use LWP::UserAgent;
use HTTP::Request;
use URI;

my $ua = LWP::UserAgent->new();

my $uri = URI->new('http://ads.bfast.com/clients/etoys/dot_clear.gif');

my $req = HTTP::Request->new(GET => $uri);
my $res = $ua->request($req);

if ($res->is_success) {
        my $len = length($res->content); # length that I measure
        if ($len == $res->header('content-length')) {
                print "Got $len bytes from ",$res->base,"\n";
        } else {
                print "Did not get $len bytes from ",$res->base,"\n";
        }
} else {
        print "Did't get the page.\n";
}


-- 
Tim Allwine
IX Development Laboratories
(707)-543-8030 Ext.15

Reply via email to