I wish to check 2 absolute paths to images on two different servers of mine. If it exists in the first path then I'd echo a message, but if no file is found then I'd check the second path and echo a message if it's found. If that's not found I'd show a Final message saying no file found.
However I've tried using file_exists and I always seem to get a message that no file is found despite a file definitely being there. Can anyone help and advise here please?
file_exists won't work on a remote machine; it is listed as belonging to the stat family, and as such are not supported by http protocol. You can use the ssh2.sftp protocol though.
Ok, have found the answer and can use fopen(). Just another question on this though please. I plan to use this check on several images on my front page of my website like this. Is using fopen() here like this on several images putting a huge strain on my server?
Sure, I mean you're using fopen remotely so each check has to go out and connect to the remote machine. Its no different than navigating to a website and loading an image, the only difference is you are not actually moving the data.
BTW, it will also only work remotely if you have allow_url_fopen enabled, and it must be served via the HTTPD on the remote machine. Otherwise use sockets.