Page 1 of 1

Check File

Posted: Thu May 31, 2007 6:33 am
by jorefice
Not sure if this is the right section to post this or not but heres my question

I need to check a file on a server to see if it exists, check the date it was created, and the size of it. It is a separate server from the linux server that i am running my php page from.

Is there a way to code in a username and password so that I can connect to the server and pull the info I need?

Posted: Thu May 31, 2007 6:52 am
by onion2k
If you've got cURL compiled in then you can use a combination of CURLOPT_HEADER and CURLOPT_NOBODY to grab the headers and ignore the body of a request for the file. That should give you enough to figure out if the file exists and how big it is if it's there.

Posted: Thu May 31, 2007 7:33 am
by feyd
There's get_headers() too, if you're running PHP 5.

Posted: Thu May 31, 2007 7:53 am
by jorefice
I am running PHP 4.4