PHP code example of f00x / anti-bitrix
1. Go to this page and download the library: Download f00x/anti-bitrix library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
f00x / anti-bitrix example snippets
use f00x\AntiBitrix;
Captcha\ReCaptcha($secret);
/**
$settingsBitrix = hp */
'connections' =>
array(
'value' =>
array(
'default' =>
array(
'className' => '\\Bitrix\\Main\\DB\\MysqliConnection',
'host' => 'hostDB',
'database' => 'test',
'login' => 'root',
'password' => 'password',
'options' => 2.0,
),
),
'readonly' => true,
),
'anti_bitrix' => [
'smtp' => [
'host' => 'smtp.example.com',
'port' => '465',
'username' => 'from',
'password' => 'password',
'encryption' => 'ssl',
'is_ntlm' => false,
'from' => '[email protected] '
],
're_captcha'=>[
'site_key'=>'key',
'secred_key'=>'key2',
]
],
);
$ConfigManager = new AntiBitrix\ConfigManager($settingsBitrix);
$Proxy = new AntiBitrix\ProxyForm($ConfigManager);
$FormManager = new AntiBitrix\FormManager($ConfigManager->getMysqlPDOConnect());
// 1 - id form in bitrix admin
$Form = $FormManager->getFormObject('1');
if ($Form instanceof Form) {
$Proxy->addForm($Form);
$Proxy->proxyPostDataForm();
}
// 1 - id form in bitrix admin
if($Proxy->isSuccess(1))
{/* print message and other */
}
$SendManager = new SmtpMessageManager($ConfigManager->getMysqlPDOConnect());
$SendManager->setSmtp($ConfigManager->getSmtpMailer());
$SendManager->sendMsgForm($Form)