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
| <?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'damien';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'dbdmozcopy';
mysql_select_db($dbname);
for($i=0; $i <= 100 ; $i++)
{
$sql = 'SELECT
concat(thosts.sHost,
textlinks.sPage) as url
FROM
textlinks
Inner Join thosts ON thosts.id = textlinks.idHost where textlinks.id='. $i;
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
// on fait une boucle qui va faire un tour pour chaque enregistrement
while($data = mysql_fetch_array($req)){
$tags = get_meta_tags('http://'.$data['url']);
// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
echo $tags['author']; // name
echo $tags['keywords']; // php documentation
echo $tags['description']; // a php manual
echo $tags['geo_position']; // 49.33;-86.59
$sql1="INSERT INTO newdata ('', id, author, keywords, description, geo_position)
VALUES
('','$i','$tags[author]','$tags[author]','$tags[keywords]','$tags[description]','$tags[geo_position]')";
}
}
// on ferme la connexion à mysql
mysql_close();
?> |
Partager