Enter a search term check the script type and click submit. To search for a general category for example to find all results for scripts working with text files or file manipulation enter file or curl. Same for directory, sql etc. Otherwise use specific terms.
Here is the script you requested.
scripts/dom-xml-scraper.txt: 1011 bytes
scraper scrape html using domxml return rip html data from file or url and display
by editing html t
ags to search for
domxml dom xml content scraper
dom-xml-scraper date added Jan 2013
<?php
$html=
file_get_contents($html);
// check if DomXML is ava
ilable:
if (!function_exists('DomDocument')){
die('DomXML extens
ion is not available :-(');
}
print '<pre>';
// create new DO
M object:
$
dom = new DomDocument();
// load HTML code:
$dom->loa
dHtml($html);
// get tags by tagname (all
<a> tags / links):
$tag
s = $dom->getElementsByTagName('a');
// loop trough all links:
fo
reach ($
tags as $a){
print '<b>' . $a->nodeValue . '</b><br/>'
;
// does this tag have attribute
s:
if ($a->hasAttributes
()){
// loop trough all attributes:
foreach (
$a-
>attributes as $attribute){
print '- ' . $attrib
ute->name . ': ' . $attribute->va
lue;
print "<br/>";
}
}
print "<hr/>";
}
print '</p
re>';
?>
Post a comment
No comments yet