How to Open web-site/page through perl

May 7, 2009 at 03:34:26
Specs: Debian Linux x86_64

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


See More: How to Open web-site/page through perl

Report •


#1
May 7, 2009 at 06:04:01

search CPAN for LWP module

Report •

#2
May 7, 2009 at 08:57:46

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.


Report •

#3
May 7, 2009 at 19:15:48

Now i am trying!!
Thanks for your answers.

Regards,
Aura Networks


Report •

Related Solutions

#4
May 8, 2009 at 04:51:12

#! /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


Report •

#5
May 11, 2009 at 00:52:12

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


Report •

#6
May 11, 2009 at 02:06:10

as the error message says, you probably forgot to do
"use WWW::Mechanize"

Report •

#7
May 11, 2009 at 02:43:15

#My Program
#----------------
#! /usr/bin/perl

use 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


Report •

#8
May 11, 2009 at 02:45:16

have you really installed WWW::Mechanize module? how did you install it ?

Report •

#9
May 11, 2009 at 03:53:00

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=accom

After opening this site i need to change the month as i required, how can i change the month....!!!

Please please help me ..


Report •


Ask Question