Page 1 of 1
Newsbot - a few problems... :(
Posted: Thu Jun 21, 2007 5:42 pm
by Nomolas
Hello,
I've a problem (hmm 3 i'm afraid

) with a newsbot-mod. I want to post news of Tweakers.net (dutch site) in my newsforum, but i've a few problems
- BBCode UID: When I submit a post (by using submit_post) you see the uid. Example: instead of . After editing, everything's right...
- What's a good method to prevent that posts are posted more than 1 time? My method doesn't work...
- How can I convert HTML to text? (Example: ' instead of #39;)
Those are my problems... O yes my source:
http://forum.probleemoppc.com/bot.php?bron
PS: What's a good method to run this bot? Include in common.php or by a crontask?
Re: Newsbot - a few problems... :(
Posted: Thu Jun 21, 2007 9:35 pm
by Paul
Re: Newsbot - a few problems... :(
Posted: Fri Jun 22, 2007 6:40 am
by Nomolas
Thanks! The problems 2 & 3 are solved, but problem 1 exists....
This is the code, related to my problem (I thin):
Code: Select all
$title = utf8_normalize_nfc($title[1][$i]);
$bbcode_uid = $bbcode_bitfield = $flags = '';
$message = utf8_normalize_nfc($message);
generate_text_for_storage($title, $bbcode_uid, $bbcode_bitfield, $flags);
generate_text_for_storage($message, $bbcode_uid, $bbcode_bitfield, $flags, true, true, true);
// If the news is already in our database....
$sql = "SELECT post_subject FROM " . POSTS_TABLE . " WHERE `post_subject` = '" . $title . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if ( !$result || $row !== null && in_array($title, $row) || empty($result) || empty($row) ) {
continue; // there is no reason the continue THIS iteration.
}
// Prepare some data
$this_i_post_data = array_merge($post_data, array(
"topic_title" => $title,
"message_md5" => md5($message),
"bbcode_uid" => '',
'message' => $message,
));
// Submit the post
submit_post("post", $this_i_post_data['topic_title'], $bot_data['username'], POST_NORMAL, $poll, $this_i_post_data);
Re: Newsbot - a few problems... :(
Posted: Fri Jun 22, 2007 7:35 am
by Paul
Read the docs again, and then special the part about the bbcode uid/bitfield, and what you need to do with that.
Re: Newsbot - a few problems... :(
Posted: Fri Jun 22, 2007 10:44 am
by Nomolas
And what's wrong with my code, I can't find that.
Re: Newsbot - a few problems... :(
Posted: Fri Jun 22, 2007 11:09 am
by Paul
that you dont give the bbcode uid/bitfield to submit post.
Re: Newsbot - a few problems... :(
Posted: Sun Jun 24, 2007 8:22 am
by Nomolas
Even this dusn't work:
bot.php
(Uploaded to my own codehost; line-numbering and highlighting are included).
The problems:
- I don't know how to convert #39; to '
- The BBCode uid doesn't work.....
- I don't know how to run it; cron ? Or include in common.php?
- My check doesn't work...
If nobody can help me, I abandone this mod

Re: Newsbot - a few problems... :(
Posted: Sun Jun 24, 2007 8:53 am
by Paul
You still hasnt set correctly the bbcode bitfield.
Re: Newsbot - a few problems... :(
Posted: Sun Jun 24, 2007 9:05 am
by Nomolas
And how can I do that correctly?
Re: Newsbot - a few problems... :(
Posted: Sun Jun 24, 2007 2:02 pm
by Nomolas
I've found my mistake, but those problems are still present:
- I don't know how to convert #39; to '
- I don't know how to run it; cron ? Or include in common.php?
Re: Newsbot - a few problems... :(
Posted: Tue Jun 26, 2007 10:42 am
by Nomolas
Anybody?