• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

reading data off of a webpage being generated with php

MrDudeMan

Lifer
I'm playing a browser based game that is written in PHP. What I'd like to do is read information off of the webpage and use it to change values in a calculator utility I've written instead of plugging the information in manually.

The problem is I have no idea how to get the values off of the page. I'm a programmer in 'conventional' languages and have next to no experience with html. I can write the app to do this in php or if there is a better route please let me know.

The attached pic is the interface to the game. All of the numbers (e.g. 1884/11800) are what I want to save to a variable somehow.

Any ideas would be appreciated.

imagesu.jpg
 
What languages are you familiar with? If I was doing this in Perl (or most conventional languages with regular expressions), I'd look at the source, hope there were identifiable pieces of text near the numbers I wanted, and get them out with regular expressions.

In Java I might do the same, or I might try parsing the DOM. (There are some XML parser classes in Java.)

If you like functional languages, you could try XSLT, and there's a small chance it wouldn't throw you for a loop. (Although, technically, XSLT can't have loops. 😛)

Oh, and I really hope the numbers are text and not graphics. 🙂
 
perl or C++ is probably the easiest for this. Maybe even php. explode() is a wonderful function for parsing data.

I remember coding a "findbetween" function in C++ long time ago, that worked well too for parsing.
 
Yeah regular expressions, just some simple string parsing as long as it doesn't change often. You can use the value label like "wood:"+ any closing HTML tags in the source as the marker for each value. Excel + VB would work pretty well if you wanted to port your calculator over to a spreadsheet.
 
Last edited:
Back
Top