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:
simple question

 



lostChild
stranger

May 28, 2001, 11:38 AM

Post #1 of 13 (1474 views)
simple question Can't Post

is there a way i can get a perl script to read the data in a url which is
NOT on the server the script is installed on?



mhx
Enthusiast / Moderator

May 28, 2001, 12:36 PM

Post #2 of 13 (1473 views)
Re: simple question [In reply to] Can't Post

Hi,

I hope I got you right. You want to read a file not located on the server the script is running on, but accessable via HTTP? If that's what you want, use the libwww-perl package.
Here's a small example:

Code
#!/bin/perl -w 
use LWP::Simple;

$url = "http://www.path.to/my/file";
$file = get($url);

# now, do whatever you like with file

This will read the file located under any URL $url into the scalar $file. Hope this is near to what you expected.

-- Marcus



Pro_4
User

May 28, 2001, 12:42 PM

Post #3 of 13 (1472 views)
Re: simple question [In reply to] Can't Post

hey
I was wondering you can get anything from any url correct? Well what would it return if you linked it to get something from another cgi you have on a different server. Will it give you the script or the results of activating the cgi. If people can get the script is there anyway to block that?

Thanks :)

Yes i am a palm tree. What are you plantist or something!?


mhx
Enthusiast / Moderator

May 28, 2001, 1:25 PM

Post #4 of 13 (1470 views)
Re: simple question [In reply to] Can't Post

Hi,

In Reply To
Will it give you the script or the results of activating the cgi. If people can get the script is there anyway to block that?

Trying to get a cgi-script via HTTP always results in the HTTP server executing the script. Trying to get a file using LWP is in no way different from a browser trying to get that file. So there's no need to block Wink.

-- Marcus



Pro_4
User

May 28, 2001, 1:35 PM

Post #5 of 13 (1469 views)
Re: simple question [In reply to] Can't Post

Alright man thank you for clearing that up for me, i have a few scripts that these people are trying to steal from me and if they figured that out i was afraid they could get them.

Thanks :)

Yes i am a palm tree. What are you plantist or something!?


lostChild
stranger

May 29, 2001, 5:29 AM

Post #6 of 13 (1455 views)
Re: simple question [In reply to] Can't Post

it seems like the libwww-perl package isn't installed on my server....

is there a simple script which will tell me what librarys are installed?



mhx
Enthusiast / Moderator

May 29, 2001, 5:59 AM

Post #7 of 13 (1453 views)
Re: simple question [In reply to] Can't Post

Hi,


In Reply To
it seems like the libwww-perl package isn't installed on my server....

How about installing it? If you don't have full access to the server, just install it in your cgi-bin directory. I guess it should work, but I'm not 100% sure.

In Reply To
is there a simple script which will tell me what librarys are installed?

I don't know. But you can find out where perl searches for its libraries: the paths are all stored in the @INC array. You can now use perl to execute an ll on each of these directories and print it to an HTML page. This should give you a listing of all perl include directories.

-- Marcus

P.S. If you don't feel able to build a script from the above information, tell me and I'll see if I can do a quick hack.

(This post was edited by mhx on May 29, 2001, 5:01 AM)


lostChild
stranger

May 29, 2001, 9:37 AM

Post #8 of 13 (1449 views)
Re: simple question [In reply to] Can't Post

ok then, how do i go about installing the package in my cgi-bin directory?



mhx
Enthusiast / Moderator

May 29, 2001, 9:59 AM

Post #9 of 13 (1447 views)
Re: simple question [In reply to] Can't Post

Download the package from CPAN, unpack it, and upload the contents of the lib directory to your cgi-bin directory. This should be all.

-- Marcus



lostChild
stranger

May 29, 2001, 11:33 AM

Post #10 of 13 (1444 views)
Re: simple question [In reply to] Can't Post

there is no lib directory already in my cgi-bin directory....

i presume just creating one won't work



mhx
Enthusiast / Moderator

May 29, 2001, 1:32 PM

Post #11 of 13 (1440 views)
Re: simple question [In reply to] Can't Post

No, just put it plain in the cgi-bin directory.

-- Marcus



lostChild
stranger

May 30, 2001, 11:05 AM

Post #12 of 13 (1432 views)
Re: simple question [In reply to] Can't Post

ah! right, now i get ya.......
thank you so much, i have now got it to work....
thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you



mhx
Enthusiast / Moderator

May 30, 2001, 11:40 AM

Post #13 of 13 (1429 views)
Re: simple question [In reply to] Can't Post

Hey, ok, I was just guessing Cool. Good to hear you got it running now.

-- Marcus


 
 


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

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