My day-job requires me to create code that will talk to vBulletin web sites we run. My latest task involves taking data that we get from PA Sportsticker and create posts in one of our forums. Lucky for me, somebody smarter than me figured out how to do this. It's very simple, and I've taken their work and modified it for our needs.
~~~ do_set('forumid', $forum_id); $threaddm->do_set('postuserid', $post_userid); $threaddm->do_set('userid', $userid); $threaddm->do_set('username', $user_name); $threaddm->do_set('posttext', $post_text); $threaddm->do_set('title', $title); $threaddm->do_set('allowsmilie', $allow_smilie); $threaddm->do_set('visible', $visible); $threaddm->save(); build_forum_counters($forum_id); ?> ~~~
I did see some talk abot how using that do_set method is not recommended as it bypasses the data manager object vBulletin uses. I tried using that datamanager by actually looking at the code that does posts, but couldn't get it to work. I suspect part of the problem is that the data manager assumes you are logged in, while you can post without being logged in with the method above. At least it sure looks that way. More testing is obviously required but I think I'm on the right track.
In a nutshell, the script that I wrote to parse the XML feed that Sportsticker provides will grab all the necessary info from the stream and then send that data to the above code via a POST request. Nice and simple. Hope this code sample helps.