|Well, I've been trying to right a script for this clan I'm working for (gaming clan) and they play Americas Army. What I am trying to do, is go onto aaotracker.com take the Hours of a user and convert it into a variable. Now, I've been around PHP a long time, but I still have issues with preg match. Thus, I have tried to find ways around it.|
Now, I want some help actually doing this... I don't care how it is done, as long as I end up with a number of their hours after $hours = ______
I have to use this number in some later scripts, which are really simple once I pull the hours. If you want to try out some preg_match/preg_match_all, here is the section of code I am trying to use.
<td><font face="Verdana,Arial" size="2"><b>Total time played:</b></font></td>
<td><font face="Verdana,Arial" size="2">2378.2 hours (1.5 hrs. per day)</font></td>
And of course, I would want a variable holding 2378.2 in it.
I did manage to find an XML file for a the clan wide. I have tried switches, but can't find a way to declare it a variable in the switch (I'll post it later) The XML file is here -> http://aaotracker.com/livefeed/xml_clanprofile.php?clanid=48882
And if it goes through XML, I would need Name, Tracker, Hours AND Honor set as variables.
This is the code I was trying to work with with the XML (my free little server doesn't let me use other URL's in fopen so I had to save a copy, but I should read the aaotracker xml file)
echo "Player ID: ";
echo "Name: ";
echo "Time: ";
echo "Honor: ";
echo "<br />";
die (sprintf("XML Error: %s at line %d",
Please Help, and tyia... This script has been driving me crazy and I think I officially give up on preg_match 0_o
Warn Level: 90
|Did you read any RegEx tutorials? If not; go read one. If you still can't figure out how to do this, come back here and post what you've tried/where you're stuck.|
Oh, and you know you have to use cURL to grab what you need right? You'll probably want to do this:
cURL page X, grab page source.
Use RegEx to find some numbers in the source of page X.
Store found numbers in variables.
Do something with the found data.
"The chowner of property." - Zeph
�Widespread intellectual and moral docility may be convenient for leaders in the short term, [center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce
but it is suicidal for nations in the long term.� - Carl Sagan