L
L
level20032021-12-24 15:40:28
1C-Bitrix
level2003, 2021-12-24 15:40:28

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

2 answer(s)
E
Edward, 2021-12-26
@Drayde

https://snipp.ru/php/curl

V
Vladimir, 2022-01-23
@Voffkam

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 question

Ask a Question

731 491 924 answers to any question