php-general | 2005051
Date: 05/14/05
- Next message: john <email protected>: "Re: [PHP] Hello, I'm new..."
- Previous message: Krid: "[PHP] CASE tool"
- In reply to: Claudio: "[PHP] DOMDocument and html doctype"
- Next in thread: Johannes Findeisen: "Re: [PHP] DOMDocument and html doctype"
- Reply: Johannes Findeisen: "Re: [PHP] DOMDocument and html doctype"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 2005-05-14 at 06:00, Claudio wrote:
> Hi,
> I've used loadHTML() to read a HTML file to DOM. This file starts with a
> string like
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>
> Do someone know how I can access this string? By reading the doctype back
> from DOMDocument I only found the name (HTML) but nothing more...
>
<?php
$html = <<<EOS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><body>Test<br></body></html>
EOS;
$pattern = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">';
$doc = new DOMDocument();
$doc->loadHTML($html);
preg_match($pattern, $doc->saveHTML(), $matches);
echo '<' . $matches[0] . '>';
?>
--s/:-[(/]/:-)/g
Brian GnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu ====================================================================== gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC Key Info: http://gfx-design.com/keys Linux Registered User #339825 at http://counter.li.org
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: john <email protected>: "Re: [PHP] Hello, I'm new..."
- Previous message: Krid: "[PHP] CASE tool"
- In reply to: Claudio: "[PHP] DOMDocument and html doctype"
- Next in thread: Johannes Findeisen: "Re: [PHP] DOMDocument and html doctype"
- Reply: Johannes Findeisen: "Re: [PHP] DOMDocument and html doctype"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

