launch url

N

Nagaraju.Bussa

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,
 
M

Matt Garrish

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
 
M

Mumia W.

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
 
M

Mark Clements

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/Win32-IE-Mechanize-0.009/lib/Win32/IE/Mechanize.pm

This should enable you to script IE.

Mark
 
J

Jürgen Exner

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
 
D

Dr.Ruud

Dr.Ruud schreef:
Matt Garrish:

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.
 
D

Dr.Ruud

Jürgen Exner schreef:
Dr.Ruud:
Jürgen Exner:
(e-mail address 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top