Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
nom3r1 каза:Тоест, искаш да взимаш информация от отдалечени сайтове, които предлагат RSS информация и да добавяш информацията в твоя сайт (в базата данни) или греша?
В такъв случай, ще трябва да използваш file_get_contents($url); или cURL
П.П. Виж това: http://code.google.com/p/rssingest/
Need to pass the (consistent) 'feed url'
http://<your server>/<RSSIngest path>/<PHP file>?feed_url=<your RSS URL - must stay the same as its a key>&access_key=<secret key>
<?php
include('dadada.php');
$linkkamsaita = "http://www.kaldata.com/rosebud/rss.php?catid=3";//например http://www.kaldata.com/rosebud/rss.php?catid=3 това е рсс-то на калдата
$head = explode("/",$linkkamsaita);
$sait = file_get_contents($linkkamsaita); //изчитаме URL-то
$tarsi = eregi("<item>(.*)</item>", $sait ,$nov);
$masiv = explode("<item>", $nov[0]); // слагаме новините в масив
$cou = count($masiv); //преброяваме новините
echo "<table>";
for($i=1;$i<=$cou-1;$i++) //Изкарваме новините една по една
{
ereg("<description>(.*)</description",$masiv[$i],$news); // изкарваме самата новина
ereg("<link>(.*)</link>",$masiv[$i], $link); //изкарваме линк към новината
ereg("<title>(.*)</title>",$masiv[$i], $zaglavie); //изкарваме заглавието
//echo "Заглавие:".$zaglavie[1]."<br><br>";
//echo "Новина:".$news[1]."";
$t = $zaglavie[1];
$d=$news[1];
//echo "Източник:</b> <a href ='".$link[1]."'>".$head[2]."</a><br><br>"; //посочваме източника
$sql = "INSERT INTO rss(name,news) VALUES('".$t."','".$d."')";
$mksql = mysql_query($sql) or die(mysql_error());
}
if($mks ql) {
$ssql = "SELECT * FROM rss";
$smksql = mysql_query($ssql);
while($row = mysql_fetch_assoc($smksql)) {
echo "Заглавие:".$row['name']."<br>Новина:".substr($row['news'],0,30)."<a href='site.com/cqla.php?id".$row['id']."'>Цялата новина</a>";
}
}
echo "</table>";
?>
<?php
header("Content-Type: text/html; charset=utf-8");
$xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3");
foreach ($xml->channel->item AS $rss) {
echo '<h2>'.$rss->title.'</h2>';
echo '<p>'.$rss->description.'</p>';
}
?>
<?php
header("Content-Type: text/html; charset=utf-8");
$xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3");
foreach ($xml->channel->item AS $rss) {
echo '<h2>'.$rss->title.'</h2>';
echo '<p>'.$rss->description.'</p>';
mysql_query("INSERT INTO `table` (title, desc) VALUES ('{$rss->title}', '{$rss->description}');") or die(mysql_error());
}
?>
<?php
header("Content-Type: text/html; charset=utf-8");
$xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3");
foreach ($xml->channel->item AS $rss) {
echo '<h2>'.$rss->title.'</h2>';
echo '<p>'.$rss->description.'</p>';
mysql_query("INSERT INTO `table` (title, desc) VALUES (\"{$rss->title}\", \"{$rss->description}\");") or die(mysql_error());
}
?>
nom3r1 каза:PHP:<?php header("Content-Type: text/html; charset=utf-8"); $xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3"); foreach ($xml->channel->item AS $rss) { echo '<h2>'.$rss->title.'</h2>'; echo '<p>'.$rss->description.'</p>'; mysql_query("INSERT INTO `table` (title, desc) VALUES ("{$rss->title}", "{$rss->description}");") or die(mysql_error()); } ?>
<?php
header("Content-Type: text/html; charset=utf-8");
$xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3");
foreach ($xml->channel->item AS $rss) {
echo '<h2>'.$rss->title.'</h2>';
echo '<p>'.$rss->description.'</p>';
mysql_query("INSERT INTO `table` (`title`, `desc`) VALUES ('$rss->title', '$rss->description')");
?>
<?php
header("Content-Type: text/html; charset=utf-8");
$xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3");
foreach ($xml->channel->item AS $rss) {
echo '<h2>'.$rss->title.'</h2>';
echo '<p>'.$rss->description.'</p>';
$insrow=mysql_query("INSERT INTO `table` (`title`, `desc`) VALUES ('$rss->title', '$rss->description')");
if($insrow){
header('Location: index.php');
exit;
}
}
?>
<?php
header("Content-Type: text/html; charset=utf-8");
$xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3");
foreach ($xml->channel->item AS $rss) {
echo '<h2>'.$rss->title.'</h2>';
echo '<p>'.$rss->description.'</p>';
$selrow=mysql_query("SELECT * FROM `table` WHERE title='$rss->title' AND desc='$rss->description' ");
if(mysql_num_rows==0){
$insrow=mysql_query("INSERT INTO `table` (`title`, `desc`) VALUES ('$rss->title', '$rss->description')");
if($insrow){
header('Location: index.php');
exit;
}
}
else {echo 'Вече е има добавена тази новина';}
}
?>
4d6f7a696c6c6120d0bed0b1d0bcd0b8d181d0bbd18fd18220d0b1d0bbd0bed0bad0b8d180d0b0d0bdd0b520d0bdd0b020d0b4d0bed0b1d0b0d0b2d0bad0b0d182d0b0205369746541647669736f2e2e2e
Notice: Use of undefined constant mysql_num_rows - assumed 'mysql_num_rows' in C:\xampp\htdocs\kaprizen\rss.php on line 10
<?php
header("Content-Type: text/html; charset=utf-8");
$xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3");
foreach ($xml->channel->item AS $rss) {
echo '<h2>'.$rss->title.'</h2>';
echo '<p>'.$rss->description.'</p>';
$selrow=mysql_query("SELECT * FROM `table` WHERE title='$rss->title' AND desc='$rss->description' ");
if(mysql_num_rows($selrow)==0){
$insrow=mysql_query("INSERT INTO `table` (`title`, `desc`) VALUES ('$rss->title', '$rss->description')");
if($insrow){
header('Location: index.php');
exit;
}
}
else {echo 'Вече е има добавена тази новина';}
}
?>
<?php
header("Content-Type: text/html; charset=utf-8");
$xml = simplexml_load_file("http://www.kaldata.com/rosebud/rss.php?catid=3");
foreach ($xml->channel->item AS $rss) {
echo '<h2>'.$rss->title.'</h2>';
echo '<p>'.$rss->description.'</p>';
$selrow=mysql_query("SELECT * FROM `table` WHERE `title`='$rss->title' AND `desc`='$rss->description' ");
if(mysql_num_rows==0){
$insrow=mysql_query("INSERT INTO `table` (`title`, `desc`) VALUES ('$rss->title', '$rss->description')");
if($insrow){
header('Location: index.php');
exit;
}
}
else {echo 'Вече е има добавена тази новина';}
}
?>