我正在尝试使用Simplepie获取提要,但是使用某些来源(例如this和this)时,值不会插入数据库中。
有人可以帮助解决问题吗?
$feedurls = array();
while ($row = mysqli_fetch_array($results)) {
array_push($feedurls, $row['source_name']);
}
// var_dump($feedurls);
$feed = new SimplePie();
$feed->set_feed_url($feedurls);
$feed->init();
$feed->set_cache_location('/var/www/simplepie/library/cache');
$feed->set_cache_duration(600);
$feed->handle_content_type();
// Begin feed output
$title;
$description;
$url;
$thumbnail;
$source;
foreach ($feed->get_items() as $item){
$title=$item->get_title();
$description=$item->get_description();
echo $item->get_description();
echo $item->get_link();
$url=$item->get_link();
echo "<br>";
echo "<br>";echo "<br>";
$enclosure= $item->get_enclosure();
echo $enclosure->get_thumbnail();
echo "<br>";
echo "<br>";echo "<br>";
$thumbnail=$enclosure->get_thumbnail();
$source = $item->get_feed()->subscribe_url() ;
enter code here
$insert = "INSERT INTO rss_feed(Heading,Description,News_URL,Image_URL,source_link)VALUES ('$title', '$description', '$url',' $thumbnail','$source')";