Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - Open URL from email message

 
Thread Tools Search this Thread
Old 07-05-2003, 12:19 AM   #1
Default Open URL from email message


Hi,

When reading from email message using Net:OP3 (or other means),
I need my perl program to open URLs incuded into the message. In other
words, I need the program to click links in the message.
So far I have not found the solution for that either in Net:OP3 or
anywhere else.
Does anyone have an idea how to do that?

Thanks, Lev




Lev Altshuler
  Reply With Quote
Old 07-05-2003, 02:51 AM   #2
Lev Altshuler
 
Posts: n/a
Default Re: Open URL from email message

Internet Explorer can be launched with the following system call:
system("start $url");
where $url is a variable where we stored URL read by Net:OP3.
But the task is to emulate a click on the link from email message. Launching
the browser is not
an issue here. I am not certain that launching the browser as I described
above will emulate
a click on the link from email message.

"Mina Naguib" <> wrote in message
news:XLoNa.63680$.. .
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lev Altshuler wrote:
> > Hi,
> >
> > When reading from email message using Net:OP3 (or other means),
> > I need my perl program to open URLs incuded into the message. In other
> > words, I need the program to click links in the message.
> > So far I have not found the solution for that either in Net:OP3 or
> > anywhere else.
> > Does anyone have an idea how to do that?
> >
> > Thanks, Lev

>
> Net:OP3 handles, obviously, the POP3 protocol. In other words,

"download this chunk of text, it
> should resemble something parse-able by an email client as an email

message".
>
> That's all there is to it, a chunk of text in an agreed-on format.
>
> Anything beyond that, you have to do yourself. If you expect that chunk

of message to have URLs
> that you are interested in, then you need to extract these URLs. For

simple text emails, you can
> probably get away with using a simple regular expression to collect the

URLs. For HTML-encoded
> emails, you can probably use HTML::TokeParser to cleanly extract links.
>
> Once you have the URLs (still, chunks of text) in a variable somewhere,

you want to simulate a
> "click". In other words, you want to launch a web browser that visits

these URLs.
>
> Fortunately, perl comes with what you need. Look into any of the LWP*

family of modules. For simple
> GET requests with no further interaction, LWP::Simple might be what you're

looking for.
>
> Best of luck.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQE/Bhh3eS99pGMif6wRAvX6AJ9SgfwHu7BoyeKvW2QXrYkr2Us7oA CglhRw
> CZqJOuOT4wA+yt2t866cBic=
> =Vz0g
> -----END PGP SIGNATURE-----
>



  Reply With Quote
Old 07-05-2003, 03:10 AM   #3
Steve Grazzini
 
Posts: n/a
Default Re: Open URL from email message

Lev Altshuler <> wrote:

[ dejeopardized, follow-ups set to clpmisc ]

> "Mina Naguib" <> wrote:
>> Lev Altshuler wrote:
>>> I need my perl program to open URLs incuded into the message. In other
>>> words, I need the program to click links in the message.

>>
>> LWP::Simple might be what you're looking for.
>>

> Internet Explorer can be launched with the following system call:
> system("start $url");
> where $url is a variable where we stored URL read by Net:OP3.
> But the task is to emulate a click on the link from email message.

^^^^^^^^

Isn't it a little summery for homework?

> Launching the browser is not an issue here. I am not certain that
> launching the browser as I described above will emulate a click on
> the link from email message.


You can emulate a *click* on the link using return().

sub click {
my $thing = shift;
return;
}

This is approximately what mutt does when you click on anything,
and I think it's correct behavior.

HTH
--
Steve
  Reply With Quote
Old 07-05-2003, 03:16 AM   #4
Beable van Polasm
 
Posts: n/a
Default Re: Open URL from email message

"Lev Altshuler" <> writes:

> Internet Explorer can be launched with the following system call:
> system("start $url");
> where $url is a variable where we stored URL read by Net:OP3.
> But the task is to emulate a click on the link from email message. Launching
> the browser is not
> an issue here. I am not certain that launching the browser as I described
> above will emulate
> a click on the link from email message.


You know, top-posting and full-quoting like that will get a lot of
people angry with you. You won't like it when a lot of people get
angry with you. Read this page to find out how to do it so that
everybody will accept your contributions:
http://www.netmeister.org/news/learn2quote2.html

As for "emulating a click", what other actions do you think that
clicking on a link would have than to get a web browser to display
the page linked to?


--
No, YOU'RE A CRACKPOT, which is why you think I'm a crackpot...
because all crackpots like you think everybody else is a moron
not them. -- George Hammond
http://beable.com
  Reply With Quote
Old 07-07-2003, 11:49 PM   #5
Eric Schwartz
 
Posts: n/a
Default Re: Open URL from email message

Beable van Polasm <beable+> writes:
> As for "emulating a click", what other actions do you think that
> clicking on a link would have than to get a web browser to display
> the page linked to?


The answer, if it's HTML mail, and javascript is enabled, is "darn
near anything". If the machine in question runs Windows, even more
so.

-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump