Jump to content

using php to check file names


fogofogo

Recommended Posts

Hello folks.I have a question about using php to select a file according to date. I am working on a project that uses xml to display horoscopes on a website. The xml feeds are ftp'd onto our server and have a different file name depending on the date. Unfortunetly this is the only way the xml is available.The filenaming is:Feed_name_YYYYMMDDHHMMSS_$storyid.xmlFor example:TMG_Horoscopes_Daily_Virgo_media_20060216100017_985313.xmlI'll be using php to do this, and as I'm fairly new to it, I'm not sure where to go from here. Does anyone have any advice, scripts or tutorials that might be able to help me?Thanks guys,John

Link to comment
Share on other sites

You could explode the string, then grab the date with substr()

$str = 'TMG_Horoscopes_Daily_Virgo_media_20060216100017_985313.xml';$parts = explode("_", $str);$j = count($parts) - 2;echo substr($parts[$j], 0, 8);

But I'm not sure exactly what you are asking.-hs

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...