我有一個履帶式抓取以www.bbc.co.uk/news開頭的網站。它抓取所有以http://www.bbc.co.uk/news開頭的鏈接,並找到它們的描述,鏈接和標題並將它們插入到數據庫中。插入語句在foreach語句中不起作用
由於某種原因,它似乎並未插入。
任何想法?
PS有完全不輸出,完全空白的網頁
foreach ($links as $link) {
$output = array(
"title" => Titles($link), //dont know what Titles is, variable or string?
"description" => getMetas($link),
"keywords" => getKeywords($link),
"link" => $link
);
if (empty($output["description"])) {
$output["description"] = getWord($link);
}
if (substr($ouput, 0, 26) == "http://www.bbc.co.uk/news/") {
$data = '"' . implode('" , "', $output) . '"';
$success = mysql_query("INSERT INTO news_story (`title`, `description` , `keywords`, `link`)
VALUES (" . $data . ")") or zerror_reporting();
if ($sucess) {
echo "YEAH!";
}
if (!$sucess) {
echo "NO!!";
}
print_r($data);
}}
爲什麼不使用他們的[feeds](http://www.bbc.co.uk/news/10628494)? – Dale