Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $oldSetting = libxml_use_internal_errors( true );
- libxml_clear_errors();
- $html = new DOMDocument();
- $html->loadHtmlFile($_POST['url']);
- $xpath = new DOMXPath( $html );
- $elements = $xpath->query( "//table[@class='maintable']/tr//a" );
- foreach ( $elements as $item ) {
- $newDom = new DOMDocument;
- $newDom->appendChild($newDom->importNode($item,true));
- $xpath = new DOMXPath( $newDom );
- foreach ($item->attributes as $attribute) {
- for ($node = $item->firstChild; $node !== NULL;
- $node = $node->nextSibling) {
- if (($attribute->nodeName =='valign') && ($attribute->nodeValue=='href'))
- {
- //print($node->nodeValue);
- echo $attribute->nodeValue;
- }
- else
- {
- //print("<br>".$node->nodeValue);
- echo $attribute->nodeValue.'0555';
- }
- }
- print("<br>");
- }
- }
- libxml_clear_errors();
- libxml_use_internal_errors($oldSetting);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement