|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-11-08 04:09 UTC] software at polin dot it
Example:
pippo.html
etc etc
<title>Il mio nome e' pippo</title>
<meta name="description" content"ciao ciao">
etc
pippo.php
$tags = get_meta_tags("pippo.html");
echo $tags['description'];
Case A) Failed
<title>Il mio nome e' pippo</title>
<meta name="description" content"ciao ciao">
echo $tags['description'], echos nothing
Case B) OK
<meta name="description" content"ciao ciao">
<title>Il mio nome e' pippo</title>
$tags['description'], echos ciao ciao
Case C) OK, I remove the character '
<title>Il mio nome est pippo</title>
<meta name="description" content"ciao ciao">
$tags['description'], echos ciao ciao
SUMMARY:
It seems there is a problem of get_meta_tags parsing the meta from an html file.
The problem is the ' character.
If it is contained inside a tag title before a meta then get_meta_tags fails.
If the title tag with the ' character is put after the meta, then it works.
If I delete the ' character then it works always.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 12:00:01 2025 UTC |
Sorry but when typing I forget a "=". This html and php is pasted from the source directly: test.html............................................. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Questo e' un titolo di prova</title> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <meta name="description" content="Il mio nome est pippo!"> <meta name="author" content="Andrea!"> </head> <body> </body> </html> end of file test.html............................. pippo.php..................................... <?php $tags = get_meta_tags("test.html"); echo $tags['description']."<br>".$tags['author']; ?> end of file pippo.php......................... As I said: This example (pippo.php) fails, because it does not display the description and author tags correctly. If I move the line <title> after the metas it works. If I remove the character ' from <title> it works. The file test.html has been validated at: http://validator.w3.org so the html code is correct.