Answer the question
In order to leave comments, you need to log in
1C-Bitrix site management. How to transfer data to a third-party server?
1C-Bitrix site management standard version. Is it possible to somehow transfer the data (phone number) from the feedback form to a third-party server for its further processing. Possibly using the POST method. If yes, can you tell me how. Thank you.
Answer the question
In order to leave comments, you need to log in
More or less like this:
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
$user_id = 1;
$result = \Bitrix\Main\UserTable::getList(array(
'select' => array('EMAIL', 'LOGIN', 'NAME', 'LAST_NAME'),
'filter' => array('ID' => $user_id),
'limit' => 1
));
$arUser = $result->fetch();
$post_user = 'login='.$arUser["LOGIN"].'&name='.$arUser["NAME"].'&last_name='.$arUser["LAST_NAME"].'&email='.$arUser["EMAIL"];
$URL = 'https://domain.ru/handlers/file.php';
if( $curl = curl_init() ) {
curl_setopt($curl, CURLOPT_URL, $URL);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_user);
$out = curl_exec($curl);
curl_close($curl);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question