This is my new code still not adding anything to the DB
<?php
$linksav = mysql_connect($db['host'], $db['user'], $db['passwd']);
$mysqldb = mysql_select_db('yousearc_YouSearch');
if (!$linksav) {
die('Could not connect: ' . mysql_error());
}
if (!$mysqldb) {
die('Could not connect: ' . mysql_error());
}
$sqlk = "SELECT url FROM bx_sites_main WHERE url = '{$link['link']}'";
$duperaw = mysql_query($sqlk);
if (mysql_num_rows($duberaw) > 0) {
echo "already exists DB";
}
else {
$html = file_get_contents_curl($link['link']);
//parsing begins here:
$doc = new DOMDocument();
@$doc->loadHTML($html);
$nodes = $doc->getElementsByTagName('title');
//get and display what you need:
$title = $nodes->item(0)->nodeValue;
$metas = $doc->getElementsByTagName('meta');
for ($i = 0; $i < $metas->length; $i++)
{
$meta = $metas->item($i);
if($meta->getAttribute('name') == 'description')
$description = $meta->getAttribute('content');
if($meta->getAttribute('name') == 'keywords')
$keywords = $meta->getAttribute('content');
}
$sql = "INSERT INTO bx_sites_main (url, title, entryUri, description, allowView, allowComments, allowRate, tags) VALUES ('{$link['link']}, $title, $title.date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000), $description, 3, 3, 3, $keywords')";
$addlink = mysql_query($sql);
}