Link to home
Start Free TrialLog in
Avatar of mikarei
mikarei

asked on

grabbing HTML content of a webpage

does anybody have the script for grabbing or fetching (whatever you call it) the HTML content of a webpage?
i need it urgently!!!
thanks a lot guys
Avatar of maneshr
maneshr

mikarei,

"..g or fetching (whatever you call it) the HTML content of a webpage? i need it urgently!!!.."

Here is a script that will work for you, provide you have all the Perl modules installed & you are not connecting from behind the firewall.

#!/usr/local/bin/perl

$|++;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:cgi);
$in = new CGI;

use LWP::UserAgent;
$ua = LWP::UserAgent->new;
use HTTP::Request::Common;

&head('ClinicsToGo');
&blah;
&footer;
exit;


sub head {
 print $in->header('text/html');
}

sub blah {
$url = 'http://www.hotmail.com';
$response = $ua->request(GET $url);
$html = $response->content;
print $html;
}

sub footer {
 print <<Footer;

</body>
</html>
Footer
}


Avatar of mikarei

ASKER

so, i just copy what you gave me and execute it?
Avatar of mikarei

ASKER

so, i just copy what you gave me and execute it?
Avatar of mikarei

ASKER

maneshr ..

i've tried ur script ..
it's not working :(
Avatar of mikarei

ASKER

maneshr ..

i've tried ur script ..
it's not working :(
ASKER CERTIFIED SOLUTION
Avatar of allym
allym

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
lynx -dump <your URL>
wget <your URL>
mikarei,

"..i've tried ur script ..
                     it's not working :( .."

What exactly does/does not happen? Do you get an error? If so, what is the exact error that you get?

What OS are you on? What web server are you using? Is there a URL where i can see this script?

How did you run this script (as a CGI program, or from the command line)?

Please provide as much more detail as you can.

This will help you get a more accurate answer, faster.
mikarei,

Some of these questions have been open for some time, and records indicate you logged in as recently as a week ago. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.

https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20183550 
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20192103 
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20194210 
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20199602 
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20219426
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20222147
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20229745
https://www.experts-exchange.com/jsp/qShow.jsp?ta=coldfusion&qid=20193133
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=20194224
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20169233
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20174790
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20175609
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20178005
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20178579
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20190066
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20203006
https://www.experts-exchange.com/jsp/qShow.jsp?ta=javascript&qid=20206006
https://www.experts-exchange.com/jsp/qShow.jsp?ta=frontpage&qid=20192026 
https://www.experts-exchange.com/jsp/qShow.jsp?ta=php&qid=20251453
https://www.experts-exchange.com/jsp/qShow.jsp?ta=perl&qid=20168673
https://www.experts-exchange.com/jsp/qShow.jsp?ta=perl&qid=20234353
https://www.experts-exchange.com/jsp/qShow.jsp?ta=perl&qid=20237989
https://www.experts-exchange.com/jsp/qShow.jsp?ta=perl&qid=20257925

Please note that an Easy question is normally considered to be worth 50 points.

Thanks,

Netminder
Community Support Moderator
Experts Exchange
Admin notified of user neglect. Force/accepted by

Netminder
Community Support Moderator
Experts Exchange
ahoffman:

Thanks for your help I used wget for windows to retrieve a web page.
mbormann,
so wget was a solution to your question?
then please tell support (Netminder) @ EE about the correction (even allym's solution might work as well).
ahoffmann,

Okay, so I'm not perfect... <grin>

Points for you at https://www.experts-exchange.com/jsp/qShow.jsp?ta=perl&qid=20307277

Netminder
CS Moderator