Created
December 6, 2013 23:32
-
-
Save wrossmann/7833965 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dom = new DOMDocument(); | |
// cache of the wikipedia page | |
$dom->loadHTML(file_get_contents('abe.vigoda_cache.html')); | |
foreach($dom->getElementById('persondata')->getElementsByTagName("tr") as $row) { | |
foreach($row->childNodes as $node) { | |
if( $node->hasAttribute('class') ) { | |
var_dump($dom->saveXML($node)); | |
} | |
} | |
} | |
/* example persondata: | |
<table id="persondata" class="persondata" style="border:1px solid #aaa; display:none; speak:none;"> | |
<tr> | |
<th colspan="2"><a href="/wiki/Wikipedia:Persondata" title="Wikipedia:Persondata">Persondata</a></th> | |
</tr> | |
<tr> | |
<td class="persondata-label" style="color:#aaa;">Name</td> | |
<td>Vigoda, Abe</td> | |
</tr> | |
<tr> | |
<td class="persondata-label" style="color:#aaa;">Alternative names</td> | |
<td></td> | |
</tr> | |
<tr> | |
<td class="persondata-label" style="color:#aaa;">Short description</td> | |
<td><a href="/wiki/United_States" title="United States">American</a> <a href="/wiki/Actor" title="Actor">actor</a></td> | |
</tr> | |
<tr> | |
<td class="persondata-label" style="color:#aaa;">Date of birth</td> | |
<td>1921-02-24</td> | |
</tr> | |
<tr> | |
<td class="persondata-label" style="color:#aaa;">Place of birth</td> | |
<td><a href="/wiki/New_York_City,_New_York" title="New York City, New York" class="mw-redirect">New York City, New York</a>, <a href="/wiki/United_States" title="United States">United States</a></td> | |
</tr> | |
<tr> | |
<td class="persondata-label" style="color:#aaa;">Date of death</td> | |
<td></td> | |
</tr> | |
<tr> | |
<td class="persondata-label" style="color:#aaa;">Place of death</td> | |
<td></td> | |
</tr> | |
</table> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment