3

I am trying to access the falt files from another server to one server through fopen , i am able to access those file through file path in browser like

file://external-web.miami123.org/test/test123. but when i am trying to access those through fopen in php code i am getting no such file or directory .here is my code .

$arrContextOptions=array(
            "ssl"=>array(
                "verify_peer"=>false,
                "verify_peer_name"=>false,
            ),
        );

$file =  fopen("external-web.miami123.org/test/test123",'r','1',stream_context_create($arrContextOptions));
print_r($file);
exit;
7
  • is a webserver on the external server, or are you accessing the file system directly? Commented Jul 18, 2017 at 14:21
  • and: are you working on Windows / Linux system? Commented Jul 18, 2017 at 14:22
  • yeah the webserver is external server ,i am trying to access it through fopen Commented Jul 18, 2017 at 14:24
  • i am working on windows @ ivo Commented Jul 18, 2017 at 14:25
  • if you want to access it as a file (not on a webserver, as you implicitly suggest using file:// ) \\external-web.miami123.org/test/test123 And you may have to double that to 4 backslashes in php Commented Jul 18, 2017 at 14:29

1 Answer 1

3

Without specifying a protocol, PHP will search for a file on your computer named test123 under ./external-web.miami123.org/test.

TLDR: Use http: http://external-web.miami123.org/test/test123

Sign up to request clarification or add additional context in comments.

4 Comments

when i am using the http i am getting HTTP request failed! HTTP/1.1 404 Not Found
Well then your path is wrong and points to a location that does not exist. 404 is a perfectly valid http response. Check if it is correct.
but i am able to access the files through browser a i mentioned above
check with your browser the http:// address and with your code the file:// address. Is there any possibility that you access your own computer?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.