1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
<?php
if (isset($_POST["lien"])) $lien=trim($_POST["lien"]);
else $lien="";
if ( $lien!="")
{
if (!$fp = fopen("$lien","r")) //lecture du fichier
{
echo "Echec lors de la connexion !";
}
else
{
$fp = fopen("$lien","r"); //ouveture du fichier
$page ='';
while (!feof($fp))
{ //on parcourt toutes les lignes
$page .= fgets($fp, 4096); // lecture du contenu de la ligne
}
$fichier = stripslashes($page);
$fichier = str_replace('/','',$fichier);
if(preg_match("#meta#i", "$fichier"))
{
$arra = preg_replace('#<meta name="description" content="(.+)"[ >]#i', '&_\[$1\]&_', $fichier);
$array = explode('&_', $arra);
$nb = count(array_filter($array)); // Je compte mon array
for ($numero = 0; $numero < $nb; $numero++) // boucle pour parcourir l'array
{
$numma = $array[$numero];
$numm = str_replace(chr(91),'',stripslashes($numma)); //déclaration de la variable qui contient le lien
$text = str_replace(chr(93),'',$numm);
if(preg_match("#\[(.+)\]#i", "$array[$numero]"))
{
echo $text;
}
}
}
else
{
echo "pas de balise meta !";
}
}
}
else
{
?>
<form action = "a.php" method="post">
Votre URL : <input type = "text" name = "lien"><br />
<input type = "submit" value = "Envoyer">
</form>
<?php
}
?> |
Partager