•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 423,607 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,252 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser: Programming Forums
Views: 2490 | Replies: 4 | Solved
![]() |
•
•
Join Date: Apr 2007
Posts: 34
Reputation:
Rep Power: 0
Solved Threads: 0
#!/perl/bin/perl -w
print "Content-type: text/html\n\n";
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( );
$mech->agent_alias("Windows Mozilla");
use LWP:
imple;
use HTML::TableContentParser;
$mech->get("http://google.com/");
my $filename = "admin.htm";
print $mech->content;
print "done...............";
$mech->save_content($filename);
die "cud not save ",$mech->response->status_line unless $mech->success;
print "done...............";
here is part of my perl script.
the problem is, i am trying to save that web page but the file named "admin.htm" is not generated. also no error message is generated.
if i put the print $mech -> content statement after "$mech->save_content($filename);" statement, nothing appears on the screen(program must be terminated after $mech->save_content($filename) statement).
any help or suggestion is appreciated .
thnx in advance.
print "Content-type: text/html\n\n";
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( );
$mech->agent_alias("Windows Mozilla");
use LWP:
imple;use HTML::TableContentParser;
$mech->get("http://google.com/");
my $filename = "admin.htm";
print $mech->content;
print "done...............";
$mech->save_content($filename);
die "cud not save ",$mech->response->status_line unless $mech->success;
print "done...............";
here is part of my perl script.
the problem is, i am trying to save that web page but the file named "admin.htm" is not generated. also no error message is generated.
if i put the print $mech -> content statement after "$mech->save_content($filename);" statement, nothing appears on the screen(program must be terminated after $mech->save_content($filename) statement).
any help or suggestion is appreciated .
thnx in advance.
#!/usr/bin/perl
require HTTP::Request;
require LWP::UserAgent;
$request = HTTP::Request->new(GET => 'http://google.com/');
$ua = LWP::UserAgent->new;
$response = $ua->request($request);
print $response->as_string();
a copy/page solution from http://cpan.uwinnipeg.ca/htdocs/libw...P/Request.html
require HTTP::Request;
require LWP::UserAgent;
$request = HTTP::Request->new(GET => 'http://google.com/');
$ua = LWP::UserAgent->new;
$response = $ua->request($request);
print $response->as_string();
a copy/page solution from http://cpan.uwinnipeg.ca/htdocs/libw...P/Request.html
•
•
Join Date: Apr 2007
Posts: 34
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
#!/usr/bin/perl
require HTTP::Request;
require LWP::UserAgent;
$request = HTTP::Request->new(GET => 'http://google.com/');
$ua = LWP::UserAgent->new;
$response = $ua->request($request);
print $response->as_string();
a copy/page solution from http://cpan.uwinnipeg.ca/htdocs/libw...P/Request.html
thnx lordspace,
but i want to automate saving page(ie. i want to save google or any other page to my hard drive.)
and i think mechanize should work for tht.
hope 2 c ur reply...
thnx again.......
•
•
Join Date: Apr 2007
Posts: 34
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
thnx lordspace,
but i want to automate saving page(ie. i want to save google or any other page to my hard drive.)
and i think mechanize should work for tht.
hope 2 c ur reply...
thnx again.......
neways i got it.........
$mech->get( "http://google.com", ":content_file" => "d:/google.htm");
thts how i could save tht page......
thnx for ur suggestion.
u were very near...
bye........
![]() |
•
•
•
•
•
•
•
•
DaniWeb Perl Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- problem in running perl script (Perl)
- file download problem (Perl)
- problem clicking on button (Perl)
- "use" statement inside an eval: problem? (Perl)
- Perl/CGI (Saving Data) Part III (Computer Science and Software Design)
Other Threads in the Perl Forum
- Previous Thread: 500 Internal Server Error - with a twist
- Next Thread: export excel sheet as a csv


Linear Mode