Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Q: file open from another server

Status
Not open for further replies.

truenight

Programmer
Oct 12, 2001
4
AU
Im Writing a cgi script and I want to open a text file to append which is found on another server.

Have tried:

open (OUTFILE, ">>http:\\servername.com\nameoffile.txt");

However this doesn't seem to work.

Any suggestions appreciated.
 
I don't think the open function will negotiate
the http stuff. open will work on files (or pipes)
that are 'visible' on the current file system. In other
words, if you cant 'cd' to that dir and see that file,
then open can't either.

Seems to me you have two general options:
1 - mount the drive on the second server from the first
so your application can 'see' it.
2 - write/run an application on the second server that will
do the trick when asked.... using sockets, or
even some unconventional CGI. There could be quite
a few approaches to doing this.

I my opinion, the best approach would be to make the drive
on the second server 'visible' (mount it) from the first server
and setup permissions and such appropriately.

HTH If you are new to Tek-Tips, please use descriptive titles, check the FAQs,
and beware the evil typo.
 
I've done something like this and it worked pretty well. What I did was write a "cgi" program to run on the second server and update the file. I call it a quote-cgi-unquote program because it really doesn't do anything for a browser, but it does use http protocol for communicating with the calling program. It gets a POST request, does what it should, and returns a few lines (can be html or text, depending on the content-type header) with the results so the calling program can parse them. I call the program from the other server using the LWP library. Worked like a charm!
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top