Created
February 9, 2012 02:10
-
-
Save saverdaj/1776512 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 | |
include("simple_html_dom.php"); | |
// Create DOM from URL or file | |
$html = file_get_html('http://www.google.com/'); | |
// Find all images | |
/*foreach($html->find('img') as $element) | |
echo $element->src . '<br>'; | |
// Find all links | |
foreach($html->find('a') as $element) | |
echo $element->href . '<br>'; | |
*/ | |
error_reporting(E_ERROR | E_PARSE); | |
$dom = new DOMDocument(); | |
$dom->loadHTMLFile('http://www.xbox360achievements.org/games/retail/'); | |
$xml = simplexml_import_dom($dom); | |
$links = $xml->xpath('//table/tr/td/a'); | |
for($i=30;$i<count($links);$i++): | |
?> | |
<a target="_blank" href="http://www.xbox360achievements.org/games/retail/<?php echo $links[$i]['href']; ?>"><?php echo $links[$i]['href']; ?></a><br/> | |
<?php | |
endfor; | |
echo "Hi"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment