PHP parsing invalid html

Posted by kmunky on Stack Overflow See other posts from Stack Overflow or by kmunky
Published on 2010-04-24T01:11:04Z Indexed on 2010/04/24 1:13 UTC
Read the original article Hit count: 440

Filed under:
|
|

hi , i'm trying to parse some html that is not on my server

    $dom = new DOMDocument();
    $dom->loadHTMLfile("http://www.some-site.org/page.aspx");      
    echo    $dom->getElementById('his_id')->item(0);

but php returns an error something like ID his_id already defined in http://www.some-site.org/page.aspx, line: 33. I think that is because DOMDocument is dealing with invalid html. So, how can i parse it even though is invalid?

© Stack Overflow or respective owner

Related posts about php

Related posts about domdocument