What I want to do, is loop through each forum category ('news & announcements', 'report a bug/fault') and store the id of the forum and the time it was last posted in in an array..
I eventually plan to make this into an application that checks this main forums.ws page for categories that were recently posted in, and if the recent posted in time is different than what's stored in the database, it'll go to that category and retrieve a list of the most recently posted in topics etc..
This is what I have. Keep in mind it works exactly how I want, but I have a feeling there is a simpler way of doing it.
This looks fairly simple to me.
I don't see a purpose for the preg replace though. The data doesn't appear that it will have any issues without a replacement. I would however convert it to a timestamp using strtotime instead. That will make sorting it easier, as well as allowing a different format. That said, this step can occur at any time you desire, so you can wait until you are checking if you want to.
As for a simpler way, not really. You can use straight pattern matching to do what you want, but matching is relatively slow to do. You can use a full dom, but that wastes memory more (what you have appears to be a dom/xpath hybrid with the custom functions you are using). Using the dom with xpath would result in something almost the same as what you have here.
All and all, what I'd suggest is actually contacting the owner of that page, to see if they have an xml or RSS feed you can tap into. Typically, you wouldn't check all the time, but once every half hour or so is sufficient. If that is available, that will make life a whole lot easier as you don't need to do anything with PHP, except maybe bringing it in and formatting it with an xslt.
This looks fairly simple to me.
I don't see a purpose for the preg replace though. The data doesn't appear that it will have any issues without a replacement. I would however convert it to a timestamp using strtotime instead. That will make sorting it easier, as well as allowing a different format. That said, this step can occur at any time you desire, so you can wait until you are checking if you want to.
As for a simpler way, not really. You can use straight pattern matching to do what you want, but matching is relatively slow to do. You can use a full dom, but that wastes memory more (what you have appears to be a dom/xpath hybrid with the custom functions you are using). Using the dom with xpath would result in something almost the same as what you have here.
All and all, what I'd suggest is actually contacting the owner of that page, to see if they have an xml or RSS feed you can tap into. Typically, you wouldn't check all the time, but once every half hour or so is sufficient. If that is available, that will make life a whole lot easier as you don't need to do anything with PHP, except maybe bringing it in and formatting it with an xslt.
Thanks. Before using preg_replace on the date/time it would have a bunch of spaces on either side.