Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getting the content of a url...

0 views
Skip to first unread message

sCALP

unread,
Aug 26, 1998, 3:00:00 AM8/26/98
to
Hi!
i want to do something like:

open(MY_ID,"<http://myhost/myrep/myfile");
open(MY_OTHER_ID,">myfile_local");
while(<MY_ID>)
{print MY_OTHER_ID $_;}
close(MY_OTHER_ID);
close(MY_ID);

how is it possible ???(i haven't learn how to use sockets yet... so if you
can tell me the syntax!)

second thing:
if my perl begin with:

BEGIN {$ENV{'HOST'} = "my own value";}

and if ,after, i open my file, does the remote file have as
$ENV{'REMOTE_HOST'}, the value i entered??
if not, how can i do that?

It's to manage to fake informations sent to a url, so i can just get the
content of the url, without having my ip or host or servername logged...

i thank everyone who will help me.
sc...@orka.fr
scalp.

Roman M Ivanov

unread,
Aug 27, 1998, 3:00:00 AM8/27/98
to
sCALP wrote:
>
> i want to do something like:

#!/usr/bin/perl

use LWP::UserAgent;

$ua = new LWP::UserAgent;
$ua->agent("Grab/0.1 " . $ua->agent);

# Create a request
my $req = HTTP::Request->new( GET => "http://somewhere/something");

# Pass request to the user agent and get a response back
my $res = $ua->request($req);

# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}

> second thing:
> if my perl begin with:
>
> BEGIN {$ENV{'HOST'} = "my own value";}
>
> and if ,after, i open my file, does the remote file have as
> $ENV{'REMOTE_HOST'}, the value i entered??
> if not, how can i do that?

You can check it by getting http://hostname/cgi-bin/printenv
Also you MUST have printenv on server!

--
+--------------------------------------------------------------------
|Roman M.Ivanov, Administration of Novosibirsk Region, Russia,
|630011, Novosibirsk, Krasny prospekt, 18, http://www.adm.nso.ru/
| tel +7-3832-23-66-40, 23-54-44, fax +7-3832-236972
| mailto:po...@obladm.nso.ru or mailto:roman...@netscape.net
| ICQ UIN 8160057

0 new messages