TheFilmGod Posted February 8, 2008 Share Posted February 8, 2008 Can I use php to go into a directory on another server and check if a file name exists? I don't need to write on the other server, I only need to check if a file name exists. Thanks! Quote Link to comment Share on other sites More sharing options...
AV1611 Posted February 8, 2008 Share Posted February 8, 2008 You can... maybe. If you have control over the other server, no problem. I suspect you are wanting to validate a link instead? That's harder. Which one? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted February 8, 2008 Share Posted February 8, 2008 If you have access to write and push data through cURL to a 0777 directory and you want to avoid overwriting I'd suggest you simple say $test = file_get_content($file_in_question) if(strlen($test) < 100){ #No file found probably } Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted February 9, 2008 Author Share Posted February 9, 2008 You can... maybe. If you have control over the other server, no problem. I suspect you are wanting to validate a link instead? That's harder. Which one? That's right - I would like to validate a link. How do I do this? Quote Link to comment Share on other sites More sharing options...
resago Posted February 9, 2008 Share Posted February 9, 2008 if its being served, you can use file_get_contents() Quote Link to comment Share on other sites More sharing options...
blackcat1313 Posted February 9, 2008 Share Posted February 9, 2008 Yes, but doesn't that require you to enable allow_url_fopen? My understanding is that this opens a security hole and many hosts don't allow it. Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted February 9, 2008 Author Share Posted February 9, 2008 I don't want to read or write on that "other" server. I only want to use php to see if a file in the file directory called "something.pdf" exists. Is this possible? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.