note 32588 deleted from function.get-meta-tags by alindeman
| From: | alindeman@php.net | Date: | Mon, 02 Jun 2003 12:28:40 +0000 |
| Subject: | note 32588 deleted from function.get-meta-tags by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49557@lists.php.net to get a copy of this message | ||
Note Submitter: thenewskymaster@yahoo.it
----
To get the meta-tags and the IP of a page use this code!
You can also decide what message to return if the meta-tag isn't specified in the page!
------------------1.php--------------
<?Php
echo "<h2>Estrai le informazioni di una pagina</h2>";
echo "
<form method=\"post\" action=\"2.php\">
Inserire l'indirizzo completo di http://<br /><br />
<input type=\"text\" name=\"file\" value=\"http://\" />
<input type=\"submit\" value=\"Estrai\" />
</form> <br /><br />"
?>
------------------------------------------------------
-------------------------2.php------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dati Pagina</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="stile.css" />
</head>
<body>
<h2>Informazioni</h2>
<?Php
//Estrazione IP
echo "<h4>L'IP del sito internet spedificato è : </h4>";
$ip = gethostbyname($file);
echo "$ip<br /><br />";
//Meta Tag
$tags = get_meta_tags($file);
// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
$autore = $tags['author']; // name
$keywords = $tags['keywords']; // php documentation
$descrizione = $tags['description']; // a php manual
$psozione = $tags['geo_position']; // 49.33;-86.59
echo "<h4>Meta-Tags</h4>";
if(!$autore){echo "<b>Autore : </b>Non specificato<br />"; }else{echo
"<b>Autore : </b>$autore<br />";}
if(!$keywords){echo "<b>Parole chiave : </b>Non specificate<br />";
}else{echo "<b>Parole Chiave : </b>$keywords<br />";}
if(!$descrizione){echo "<b>Descrizione : </b>Non specificata<br />";
}else{echo "<b>Descrizione : </b>$descrizione<br />";}
if(!$posizione){echo "<b>Posizione : </b>Non specificato<br />";
}else{echo "<b>Posizione Geografica : </b>$psozione<br />";}
?>
</body>
</html>
-------------------------------------------------------