On Sunday, Jul 27, 2003, at 19:32 US/Pacific, Luinrandir Hernsen wrote: [..]
I will try your suggestion
Is there another way to do this? with out the LWP::UserAgent????

Quite the Correct Question!


Yes, but it would involve things like actually doing your own

        use Socket;
        use FileHandle;

sorts of 'open the socket, push some stuff down it, get the
answer back' and then deconstruct it...

If you have the time, I HIGHLY recommend this exercise. Nothing
will help you better understand the in's and out's of HTTP and
hence what browser/servers are doing than to actually build out
your own solution here. So yes, not only build out a 'web-bot'
but take a shot at the 'server side' as well....

The question of course is whether you can avoid 're-invent the wheel'
when there is this really nice set of modules already there to be used.

If you take the time to 'do your own' - you may decide that
your 're-invention' is 'good enough' for your needs - or
you may also verify - "way too much work....." and hence
opt to use as many of the CPAN modules that you find that you trust
and like....

I see you are using a get command.. ok I know about those....

to say it better I want to get the output / HTML code from another web
site...
the stuff between the <HEAD> to </BODY> commands... clearer?

I have appended the test code I was playing with at the end, and as you will see I cheated by using

use Data::Dumper;

that shows you what that $response is all about.

many thanks.. I am real new to this...

We all start some place. You will want to take a peek at

perldoc Data::Dumper

as it can be your best friend in all of this.

I'll look up the perldoc stuff too.

Also remember that at times


perldoc -m "foo::bar::baz"

will let you look INSIDE that modual at what is REALLY going on.

[..]

The code below just gets me the name of your home page as a string..... correct?

incorrect.


but were I to do something like say
my $url = URI->new();
$url->scheme('http');
$url->host($host_port);
$url->path('/drieux');

my $response = $ua->get($url->as_string());

this code fragment returns an


HTTP::Response

object and inside of it, you have the actual content
of the 'web page'.

I would of course recommend that you use something
like the HTML::TreeBuilder to 'deconstruct' the
web page back into information you really want out
of that web page.

ciao
drieux

---

the test code I was playing with.

        #!/usr/bin/perl -w
        use strict;
        use URI;
        use Data::Dumper;
        use LWP::UserAgent;
        
        # #FILENAME# - is for
        
        my $host_port = 'www.wetware.com';
        
        my $url = URI->new(); #$host_port, 'http');
        
        $url->scheme('http');
        $url->host($host_port);
        $url->path('/drieux');
        
        print Dumper($url);
        
        print "#----------\n";
        
        my $string = $url->as_string;
        print "$string\n#------\n";
        
         my $ua = LWP::UserAgent->new();
         my $response = $ua->get($url->as_string());
        ###
         print Dumper($response);


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



Reply via email to