How do I open remote files in php
Moderator: General Moderators
How do I open remote files in php
Hey all,
I'm in a fix and am not able to solve this problem!
I have a file located on a server machine and I wanna read that file!
the server name is server.safl.umn.edu
and, if I specify this $file = '\\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat'; $fp = fopen($file,"r")
it gives me the following error
Warning: fopen(\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat) [function.fopen]: failed to open stream: No such file or directory in C:\websites\techtest.safl.umn.edu\Vivek\demo3.php on line 54
All the access permissions are there, but it just doesnt work!
I'm in a fix and am not able to solve this problem!
I have a file located on a server machine and I wanna read that file!
the server name is server.safl.umn.edu
and, if I specify this $file = '\\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat'; $fp = fopen($file,"r")
it gives me the following error
Warning: fopen(\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat) [function.fopen]: failed to open stream: No such file or directory in C:\websites\techtest.safl.umn.edu\Vivek\demo3.php on line 54
All the access permissions are there, but it just doesnt work!
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Hey, thanks for the reply
But it still doesnt work!
string file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )
I dont think, apart from the filename, the other parameters r compulsory!
Btw, i'm not sure what resource context means!
Please tell me if this syntax is correct!
$file = file_get_contents("\\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat");
But it still doesnt work!
string file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )
I dont think, apart from the filename, the other parameters r compulsory!
Btw, i'm not sure what resource context means!
Please tell me if this syntax is correct!
$file = file_get_contents("\\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat");
Try it out, see what happens. Best way to learn.vivsriaus wrote:Hey, thanks for the reply
But it still doesnt work!
string file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )
I dont think, apart from the filename, the other parameters r compulsory!
Btw, i'm not sure what resource context means!
Please tell me if this syntax is correct!
$file = file_get_contents("\\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat");
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
try this first
Although I don't remember if php understands Windows UNC coding, natively.. I'd seem to remember it doesn't. Is the code being run on a Windows machine?
Code: Select all
$file = '\\\\server.safl.umn.edu\\common\\cellis\\safl weather\\saf_wthr.dat';Although I don't remember if php understands Windows UNC coding, natively.. I'd seem to remember it doesn't. Is the code being run on a Windows machine?