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! Link to comment https://forums.phpfreaks.com/topic/90081-checking-other-server-files/ 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? Link to comment https://forums.phpfreaks.com/topic/90081-checking-other-server-files/#findComment-461875 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 } Link to comment https://forums.phpfreaks.com/topic/90081-checking-other-server-files/#findComment-461878 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? Link to comment https://forums.phpfreaks.com/topic/90081-checking-other-server-files/#findComment-462309 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() Link to comment https://forums.phpfreaks.com/topic/90081-checking-other-server-files/#findComment-462317 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. Link to comment https://forums.phpfreaks.com/topic/90081-checking-other-server-files/#findComment-462354 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? Link to comment https://forums.phpfreaks.com/topic/90081-checking-other-server-files/#findComment-462360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.