Topic: RSS newsbot not working so well
Ok... i wrotes this little script... but the html is not well parsed.
I am bypassing the html special chars the way elbecko told me here
this is just the beggining, but is not working so well... i guess i alsoforgot to update some post counts but i go into that later.... by now i would like to have the html well parsed...
i picked a feed with a lot of html on purpose.
can anybody point me where and with parsing am i missing?
thx
<?
require('magpierss/rss_fetch.inc');
$db_host = 'localhost';
$db_name = 'my_db';
$db_username = 'imacooluser';
$db_password = 'mypass';
mysql_connect($db_host, $db_username, $db_password);
mysql_select_db($db_name);
$url="http://chrisgoes.blogspot.com/rss.xml";
$rss = fetch_rss($url);
foreach ( $rss->items as $item ) {
$topic_subject = $item['title'];
$poster = "postbot";
$timenow = time();
$topic_forum_id = 2;
$post_message = mysql_escape_string($item['description']);
$poster_id = 3;
$sql="
insert into topics
(subject,
poster,
posted,
forum_id,
last_post_id,
last_poster)
values
('$topic_subject',
'$poster',
$timenow,
$topic_forum_id,
$timenow,
'$poster')";
mysql_query($sql);
$topic_id = mysql_insert_id();
$sql="
insert into posts
(poster,
poster_id,
message,
html,
hide_smilies,
posted,
topic_id)
values
('$poster',
$poster_id,
'$post_message',
1,
1,
$timenow,
$topic_id)";
mysql_query($sql);
$last_post_id = mysql_insert_id();
$sql="update topcics set last_post_id=$last_post_id where id=$topic_id";
mysql_query($sql);
}
?>