PDA

View Full Version : API Content Text


BulliM
11-06-2018, 07:38 PM
Here is my final auto log in and auto post script.

<?php define('CSRF_PROTECTION', false);

$vbpath = '';
require_once($vbpath.'/includes/vb5/autoloader.php');
vB5_Autoloader::register($vbpath);
vB5_Frontend_Application::init('config.php');

$api = Api_InterfaceAbstract::instance();
$loginInfo = $api->callApi('user', 'login', array('Username', 'Userpassword'));

if (empty($loginInfo['errors']))
{
vB5_Auth::setLoginCookies($loginInfo, '', true);

$data = array(
'hvinput' => '',
'title' => "Title",
'rawtext' => "<h4>Head</h4><p>Content<br />other Content</p><script txpe="text/javascript>.....",
'parentid' => 20,
'channelid' => 20,
'nl2br' => false,
'htmlstate' => 'on',
'disable_bbcode' => true,
'tags' => 'tag1,tag2,tag3'
);

$options = array(
'skipDupCheck' => true
);

$nodeId = $api->callApi('content_text', 'add', array($data, $options));
}

?>

'htmlstate' => 'on' // Post as HTML

'nl2br' => false // No new lines to break needed

'disable_bbcode' => true // Do not convert HTML into BBcode and prevent JavaScript and other HTML-Tags from converting.