Check File

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jorefice
Forum Newbie
Posts: 2
Joined: Thu May 31, 2007 6:29 am

Check File

Post 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?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There's get_headers() too, if you're running PHP 5.
jorefice
Forum Newbie
Posts: 2
Joined: Thu May 31, 2007 6:29 am

Post by jorefice »

I am running PHP 4.4
Post Reply