getting the content of a url... 
Author Message
 getting the content of a url...

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.

scalp.



Sun, 11 Feb 2001 03:00:00 GMT  
 getting the content of a url...

Quote:

> 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";
 }

Quote:
> 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

| ICQ UIN 8160057



Mon, 12 Feb 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Getting the contents of a URL.

2. Getting contents of a URL

3. Retrieving contents of a url

4. Retrieving contents of url

5. How to import URL contents!

6. Getting Content type of a file

7. Getting content of a remote site

8. getting contents of a dir

9. Getting perl to execute after print content

10. getting web page content

11. Getting a web page content using perl

12. Help with getting file contents

 

 
Powered by phpBB® Forum Software