CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
opening from a url?

 



ultimategamer2k
User

May 17, 2001, 1:33 PM

Post #1 of 8 (1164 views)
opening from a url? Can't Post

is there any way to open files through a url?
open(FILE, "http://whatever.com/whatever.htm");
@whatever=<FILE>;
close FILE;

-------------------------------------------------------------
visit my web site at <a href=http://ultimategamer.cjb.net>here</a>


Mortimer
journeyman

May 17, 2001, 2:55 PM

Post #2 of 8 (1160 views)
Re: opening from a url? [In reply to] Can't Post

You need the file's name, not it's network protocol url. A file's name is the physical path on the computer. eg:

Code
$file = 'c:/path/to/file.ext';

Then use an event such as a link click to open the file. Then make it a habit to iterate over the lines instead of grabbing the whole lot at once.

Dave.



ultimategamer2k
User

May 17, 2001, 3:20 PM

Post #3 of 8 (1158 views)
Re: opening from a url? [In reply to] Can't Post

i know that
but i wanted to know if you could open a file from another server completely

-------------------------------------------------------------
visit my web site at <a href=http://ultimategamer.cjb.net>here</a>


Mortimer
journeyman

May 17, 2001, 3:55 PM

Post #4 of 8 (1156 views)
Re: opening from a url? [In reply to] Can't Post

Yes, if you have permission. But I suspect you want to know how without permission, right?



ultimategamer2k
User

May 17, 2001, 3:59 PM

Post #5 of 8 (1155 views)
Re: opening from a url? [In reply to] Can't Post

either way

-------------------------------------------------------------
visit my web site at <a href=http://ultimategamer.cjb.net>here</a>


emelin
stranger

May 18, 2001, 12:52 AM

Post #6 of 8 (1141 views)
Re: opening from a url? [In reply to] Can't Post

Can you use LWP::Simple?

use LWP::Simple;
$page= get( 'http://www.url.com/page.htm' );

If not, let me know (I can't on my server, so I have an alternative solution).



kojr
Novice

May 18, 2001, 5:51 AM

Post #7 of 8 (1132 views)
Re: opening from a url? [In reply to] Can't Post

Just copy and paste..
sub gethtml {
$url=$_[0];
require LWP::UserAgent;
$ua = new LWP::UserAgent;
$request = new HTTP::Request('GET', "$url");
$response = $ua->request($request);
my $html = $response->{_content};
return $html;
}

~1;



ultimategamer2k
User

May 18, 2001, 2:04 PM

Post #8 of 8 (1119 views)
Re: opening from a url? [In reply to] Can't Post

wow, thanks for the help, i will try both methods

-------------------------------------------------------------
visit my web site at <a href=http://ultimategamer.cjb.net>here</a>

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives