Reply
Help! Remote file access
Old 04-21-2004, 06:26 AM Help! Remote file access
Junior Talker

Posts: 2
I am currently writing a lookup script which uses a text file on another file server.

I am submitting a form and the value submitted is to be checked against values in the text file. If the file is stored in the same directory as the php script it works perfectly, as soon as I try to access the other server I get "No such file or directory" although I can link to it in HTML.

The code I am using is:

$filename = "\\server\dir\file.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd,filesize ($filename));

I have also tried:

$filename = readfile("\\server\dir\file.txt");
$fd = fopen ($filename, "r");
$contents = fread ($fd,filesize ($filename));

Is it actually possible to do this???
TonyL is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-21-2004, 11:32 AM
Junior Talker

Posts: 4
From my experience you cannot access the method if the file was in a different directory to the text file on the same server let alon on another server. It may be feasible to do this but i reckon it will be complicated.

Although i may be totally wrong with this next part, the main problem you face is security. Using such a method especially for remote access, available on the website would allow hackers in so be careful. As you would need to post the server login details to the server. Why don't you just keep all the files in same server?

OR

As a temporary solution:

Create a new directory but don't create the index.shtml file. This way you can then view your webpages with security. If you are after an front-end interface method approach then im not sure. Try this website, and try to speak to middleground if possible (creator of PHP Coin - Ecommerce Tool) or if not NexusDog. They should be able to put you in the right direction

www.nexusportal.net
dagma20 is offline
Reply With Quote
View Public Profile
 
Old 04-21-2004, 01:12 PM
j0e
Average Talker

Posts: 23
Location: UK
Have a look here:
http://php.net/manual/en/function.fopen.php

It says that you can access other servers (other domains anyway). Is the other server a webserver? 'cos that should work ok with this method. I'm not sure about accessing it this way though. (Maybe you need some sort of server (web/ftp etc) to access the file).

Sorry, that dosen't really help, does it? Have a look at the php.net anyway.
j0e is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help! Remote file access
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12873 seconds with 12 queries