note 32588 added to function.get-meta-tags

From: Date: Mon, 02 Jun 2003 07:06:16 +0000
Subject: note 32588 added to function.get-meta-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-49549@lists.php.net to get a copy of this message
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 &egrave; : </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> ------------------------------------------------------- ---- Manual Page -- http://www.php.net/manual/en/function.get-meta-tags.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32588 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32588&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32588&report=yes

« previous php.notes (#49549) next »