Let me put it into perspective for you, this is what two years of experience and practice does for you.
- Only works for specific values.
- Is actually broken and wont work under specific circumstances.
- Only works for game hub pages.
- Way more code then there needs to be.
- Just sucks, really, it sucks.
- Works for all variables on a hub/members page, including newly added ones.
- Should work for all pages that have available text modes.
- Works on both members and game hub pages.
- Aforementioned improvements require less code than the original script.
- A way bigger improvement over the old.
- A (hacky) method to make sure it doesn't attempt to parse pages that aren't text.
Just to give you a demonstration of how it works, he's the outputted array on a few pages:
- Icon Ultima's Hub Page
- Dragonball Online II Hub
- Lummox JR's Member Page
- Lummox JR's Member Page Extended
- My Members Page
- My Members Page Extended
And so on and so forth.
The only annoying part of the function is something I was struggling to figure out. I honestly couldn't find a way to check the Content-Type of the page with fopen() or file_get_contents() (if someone knows a way, fill me in!), so I've resorted to actually loading the page twice, one for it's headers, and if it's a text/plain page, continue on to get the content, otherwise return false.
So then, here's a PHP alternative to getting game info off the BYOND hub:
Also note: Although the text-mode of the hub uses the same format as a plain-text BYOND Savefile. That function will fail miserably if it attempts to read one. I never designed it for use with a savefile, only for use with the BYOND Hub. If the hub is updated to include a directory inside a directory, then is when I'll have to make it completely compliant with a BYOND Savefile.
Also, also note: I'll be working on a function to read a BYOND Savefile (and thus put this one out of business), but I'm not entirely sure whether or not I'll release that one. Gotta keep some tricks for myself, you know.
Yeah, I was bored today.