http://pastebin.com/raw.php?i=BBr7XCtS
I have no idea where to start, there isn't any form of class/id and I can't figure out how to regex it. Hoping to get it into a multidimensional array or something. ($array[place] would contain the 开发者_高级运维names of whichever teams, etc)
HTML regexes are failing anytime it encounters a tied vs single...
edit: okay, regex and xml isn't helping me at all :|
You can try SimpleXML - it'll move the structure of the HTML to a nice format. You will have to make sure that:
- You don't have any fragments at the beginning - in the example you gave, the first tag is a </ul>
- You wrap the entire thing in a root node
$data = '<rootnode>
<dt><br />In 179th place with 2,755 points is </dt>
<dd>
<ul>
<li>DIAL NINE: IS ANYONE PLAYING WITH US?</li>
</ul>
</dd>
</rootnode>';
$xml = new SimpleXMLElement($xmlstr);
//each dt can be accessed with
foreach ($xml->dt as $dt) {
echo $dt;
}
//each dd can be accessed with
foreach ($xml->dd as $dd) {
echo $dd;
}
//And etc
http://www.php.net/manual/en/simplexml.examples-basic.php
I would suggest multipass. First pass to divide into Tied and singles. Second pass to split up tieds.
精彩评论