From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
steve silvers
Sent: 17 June 2009 17:27
To: perl-win32-users@listserv.activestate.com
Subject: LWP Help

> I have my below snippet that when I run it from my website, it returns
the query to Yahoo, but all the links 
> are screwed up?

That's a bit vague. What do you mean by "screwed up"?

>  
> How do I fix this? Also how can I add multiple searches to this for
one call.
>  
> Thanks in advance.
>  
> #!/usr/bin/perl

"use strict; use warnings;" missing. Please include them.

> use LWP::UserAgent;
> print "Content-type: text/html\n\n";
> my $ua = new LWP::UserAgent;
> my $url =
"http://search.yahoo.com/search?p=trucks&fr=yfp-t-501&toggle=1&cop=mss&e
i=UTF-8";
> my $response = $ua->get($url);
> if($response->content_type ne "text/html"){
> die("Recieved content-type ".$response->content_type.", was
> looking for text/html.")
> }
> my $content = $response->content; # $content now holds the html page
from google.
> print $content;

Just a guess, but are the links in the returned document relative? If
so, hava a look at the example code in the doco for HTML::LinkExtor.

HTH

-- 
Brian Raven 
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient or have received this e-mail in error, please advise 
the sender immediately by reply e-mail and delete this message and any 
attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
  • LWP Help steve silvers
    • RE: LWP Help Brian Raven

Reply via email to