Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > launch url

Reply
Thread Tools

launch url

 
 
Nagaraju.Bussa@gmail.com
Guest
Posts: n/a
 
      05-12-2006
Hi,
I would like to know is it possible to launch a browser(Say IE) and
execute one web url
from perl or shell script.
please post some code regarding the same.
thanks

I have code some thing like this..

use strict;
use URI::URL;
use LWP::UserAgent;

my $url = URI::URL->new("www.yahoo.com");

my $req = HTTP::Request->new("GET", $url);
my $ua = LWP::UserAgent->new();
my $resp = $ua->request($req);

if ($resp->is_success) {
print $resp-> content;
} else {
exit 1;
}


When I execute this script, the response is printing on the unix
console,I want this to open on a browser, please let me know your
inputs.

thanks,

 
Reply With Quote
 
 
 
 
Matt Garrish
Guest
Posts: n/a
 
      05-12-2006

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hi,
> I would like to know is it possible to launch a browser(Say IE) and
> execute one web url
> from perl or shell script.
> please post some code regarding the same.
> thanks
>
> I have code some thing like this..
>
> use strict;
> use URI::URL;
> use LWP::UserAgent;
>
> my $url = URI::URL->new("www.yahoo.com");
>
> my $req = HTTP::Request->new("GET", $url);
> my $ua = LWP::UserAgent->new();
> my $resp = $ua->request($req);
>
> if ($resp->is_success) {
> print $resp-> content;
> } else {
> exit 1;
> }
>
>
> When I execute this script, the response is printing on the unix
> console,I want this to open on a browser, please let me know your
> inputs.
>


Well, when you print to STDOUT you kind of have to expect the output in your
console window. Why not just automate the browser and skip manually grabbing
the page altogether?

`iexplore www.somepage.com`;

If that's not an option, save the page you get back to file and then open
the file using IE:

`iexplore somepage.htm`;

(Assuming, of course, that the path to iexplore.exe is in your system path.)

Matt


 
Reply With Quote
 
 
 
 
Mumia W.
Guest
Posts: n/a
 
      05-12-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi,
> I would like to know is it possible to launch a browser(Say IE) and
> execute one web url
> from perl or shell script.
> please post some code regarding the same.
> thanks
>
> I have code some thing like this..
>
> use strict;
> use URI::URL;
> use LWP::UserAgent;
> [...]


In perl, I start firefox like so:
system ("firefox http://www.w3.org/");

If you must use the Internet Exploder, it's executable's name is
iexplore.exe


 
Reply With Quote
 
Mark Clements
Guest
Posts: n/a
 
      05-12-2006
(E-Mail Removed) wrote:
> Hi,
> I would like to know is it possible to launch a browser(Say IE) and
> execute one web url
> from perl or shell script.
> please post some code regarding the same.
> thanks
>
> I have code some thing like this..
>
> use strict;
> use URI::URL;
> use LWP::UserAgent;
>
> my $url = URI::URL->new("www.yahoo.com");
>
> my $req = HTTP::Request->new("GET", $url);
> my $ua = LWP::UserAgent->new();
> my $resp = $ua->request($req);
>
> if ($resp->is_success) {
> print $resp-> content;
> } else {
> exit 1;
> }
>


You may want to look at

Win32::Mechanize::IE

http://search.cpan.org/~abeltje/Win3...E/Mechanize.pm

This should enable you to script IE.

Mark
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      05-13-2006
(E-Mail Removed) wrote:
> I would like to know is it possible to launch a browser(Say IE) and
> execute one web url
> from perl or shell script.
> please post some code regarding the same.


Sure, no problem.

system ("explorer.exe http://cpan.org");

works great.

jue


 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      05-13-2006
Matt Garrish schreef:

> `iexplore www.somepage.com`;


It is not a good practice to use the browser's executable by name.

Alternatives:

C:\> start http://www.google.com /B

http://www.hcoms.co.uk/know/know_detail.php?id=371 (VB-code)

http://vb.mvps.org/samples/project.asp?id=hyperjmp (VB-code)

C:> rundll32.exe url.dll,FileProtocolHandler http://www.google.com

C:> rundll32.exe url.dll,FileProtocolHandler www.google.com

--
Affijn, Ruud

"Gewoon is een tijger."


 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      05-13-2006
Jürgen Exner schreef:
> (E-Mail Removed):


>> I would like to know is it possible to launch a browser(Say IE) and
>> execute one web url
>> from perl or shell script.
>> please post some code regarding the same.

>
> Sure, no problem.
> system ("explorer.exe http://cpan.org");
> works great.


Yuck, I tested

perl -e "system q{explorer.exe http://cpan.org}"

and it started MSIE, while the default browser on that system is Mozilla
Firefox.

--
Affijn, Ruud

"Gewoon is een tijger."


 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      05-13-2006
Dr.Ruud wrote:
> Jürgen Exner schreef:
>> (E-Mail Removed):

>
>>> I would like to know is it possible to launch a browser(Say IE) and
>>> execute one web url

[...]
> Yuck, I tested
>
> perl -e "system q{explorer.exe http://cpan.org}"
>
> and it started MSIE, while the default browser on that system is
> Mozilla Firefox.


Well, so? That's what the OP asked for:
"to launch a browser(Say IE)"

jue


 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      05-13-2006
Dr.Ruud schreef:
> Matt Garrish:


>> `iexplore www.somepage.com`;

>
> It is not a good practice to use the browser's executable by name.
> Alternatives:
> C:\> start http://www.google.com /B


"start" behaves differently on Win-9x/ME/NT/2k/XP.
AFAIK, it is a "builtin" on XP.


> http://www.hcoms.co.uk/know/know_detail.php?id=371 (VB-code)
> http://vb.mvps.org/samples/project.asp?id=hyperjmp (VB-code)
> C:> rundll32.exe url.dll,FileProtocolHandler http://www.google.com
> C:> rundll32.exe url.dll,FileProtocolHandler www.google.com


I think you need rundll.exe for Win9x/ME, so an an OS-test (or a fall
back) is needed.

--
Affijn, Ruud

"Gewoon is een tijger."


 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      05-13-2006
Jürgen Exner schreef:
> Dr.Ruud:
>> Jürgen Exner:
>>> (E-Mail Removed):


>>>> I would like to know is it possible to launch a browser(Say IE) and
>>>> execute one web url

> [...]
>> Yuck, I tested
>>
>> perl -e "system q{explorer.exe http://cpan.org}"
>>
>> and it started MSIE, while the default browser on that system is
>> Mozilla Firefox.

>
> Well, so? That's what the OP asked for:
> "to launch a browser(Say IE)"


I read that differently, the "Say" expressed to me that the poster
actually aimed for the default browser. But I am very biased in this
area. One is what one reads.

One just doesn't do that: to start the non-default browser. Unless one
likes to be hated of course. McAfee did it for a while, maybe they still
do. Microsoft still does it for Windows Update.

--
Affijn, Ruud

"Gewoon is een tijger."


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM
Is there some URL prefix that can launch a MSN Messenger Conversation? Kevin Buchan ASP .Net 2 01-22-2004 05:32 PM
Can't Launch URL from Eudora or other Programs (Netscape) ... Computer Support 1 12-14-2003 06:47 PM
Midlets, how does one read parameters set in on a URL launch ? Sam Iam Java 0 10-19-2003 08:18 AM



Advertisments