Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I am lakshmi sreekanth, new to Perl.My Doubt: Is there any way to open web-page/site by using Perl program, OS:Debian Linux.
My requirement is i need to open the site, then collect the required data from that site, then send that data to the cell phone (SMS, through internet).
Please tell me whether its possible or not, if possible then tell me the way !!!
One more thing, is there any possibility to include HTML code in the Perl code...
Thanks & Regards,
Aura Networks

You should use LWP or WWW::Mechanize. WWW::Mechanize would be more convenient in your case.
For SMS sending there are plenty modules on CPAN.
To include HTML in you Perl program you need to either use heredocs (bad solution) or templates. Look at Template-Toolkit.

#! /usr/bin/perl -w
use strict;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $response = $ua->get('http://www.ttdsevaonline.com/eseva/availabilitychart.aspx?name=accom');
if ($response->is_success)
{
print $response->content; # or whatever
}
else
{
die $response->status_line;
}
---------------
I executed above code, its working fine.When i open the above site
[http://www.ttdsevaonline.com/eseva/availabilitychart.aspx?name=accom]I am getting current month details, but the thing is i need to collect the another month details.
Site name same for this month & for next month. How can i open next month details ...!!
First how can we change the month??Please help me ..
For understanding purpose please open the site ..
Regards,
Aura Networks

Hi,
When i run the program, i am getting this error :Can't locate object method "new" via package "WWW::Mechanize" (perhaps you forgot to load "WWW::Mechanize"?) at program.pl
OS: Debian Linux
Post me, whether i required to install any thing to work WWW::Mechanize->new() in the Program!!!
Regards,
Lakshmi Sreekanth

#My Program
#----------------
#! /usr/bin/perluse strict;
use warnings;
use WWW::Mechanize;my $ua = WWW::Mechanize->new();
my $url = "http://www.ttdsevaonline.com/eseva/availabilitychart.aspx?name=accom";
my $FILE = ":content_file";
my $response = $ua->get($url, $FILE => "counter.html" );if ($response->is_success)
{
print "Success, url opened, data stored in counter.html \n";
}
else
{
die $response->status_line;
}
#----------------------Output:
home/sreekanth$ perl project_ttd.pl
Can't locate WWW/Mechanize.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at project_ttd.pl line 5.
BEGIN failed--compilation aborted at project_ttd.pl line 5.
$How to rectify the Above error !!
Please help me.Regards,
Aura Networks

Thank you very much for all of your helping..
Now its working(WWW::Mechanize),
Now my doubt is after opening the page how to select a particular field from a page, select or change the month field from the page(by default page contains present month details, i need next month details)..(Please open this site for understanding purpose:
http://www.ttdsevaonline.com/eseva/availabilitychart.aspx?name=accomAfter opening this site i need to change the month as i required, how can i change the month....!!!
Please please help me ..

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |