Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How do I post a comment using an external php script in vanilla?

edited July 2013 in Vanilla 2.0 - 2.8

I have a script written with this code to get the vanilla session and user into it:
http://vanillaforums.org/discussion/comment/141122/#Comment_141122

But now I want to use that script to add a comment to a discussion, kind of like an automated reply script.
I think this would have something to do with applications/vanilla/models/class.commentmodel.php and public function Save($FormPostValues), but I simply have no idea how I would use this from an external script like that.

define('APPLICATION', 'Vanilla');

define('APPLICATION_VERSION', '2.0.16');

define('DS', '/');

define('PATH_ROOT', '/var/www/html/testsite');

ob_start();

require_once(PATH_ROOT.DS.'bootstrap.php');

ob_end_clean(); // clear any header output from vanila

$Session = Gdn::Session();

$Authenticator = Gdn::Authenticator();

$poster = 23; //Post as this user

$discussion = 12; //Discussion where to post in

$message = "Hey everybody! This is a test." //Comment content

//what now?

Comments

Sign In or Register to comment.