Created
January 28, 2019 08:05
-
-
Save Padilo300/c29484d964562bda4767ff490bc83b53 to your computer and use it in GitHub Desktop.
bitrix добавить сделку
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$webHookScript = 'https://bitrix24.твойБитрикс.com.ua/rest/1/ep43243342u7yjj4234k4i4q026j/'; // входящий вебхук | |
$dealData = array( | |
"TITLE" => "Заказ с сайта" , | |
"TYPE_ID" => "GOODS" , | |
"STAGE_ID" => "NEW" , | |
"CONTACT_ID" => $CONTACT_ID , // если нужно прикрепить к конкретному контакту | |
"OPENED" => "Y" , | |
"ASSIGNED_BY_ID" => 1 , | |
"PROBABILITY" => 30 , | |
"CURRENCY_ID" => "UAH" , | |
"SOURCE_ID" => "WEB" , | |
'COMMENTS' => $data['comment'] , | |
'UF_FILE' => $data['files'] , | |
); | |
public function curlStart($webHookScript, $dealData){ | |
$Data = http_build_query($Data); | |
$curl = curl_init(); // создаем ресурс | |
// установим несколько параметров в рамках одного сеанса | |
curl_setopt_array($curl, | |
array( CURLOPT_SSL_VERIFYPEER => 0, | |
CURLOPT_POST => 1, | |
CURLOPT_HEADER => 0, | |
CURLOPT_RETURNTRANSFER => 1, | |
CURLOPT_URL => $queryUrl, | |
CURLOPT_POSTFIELDS => $Data, | |
) | |
); | |
$result = curl_exec($curl) ; // Выполняем запрос и записываем ответ | |
curl_close($curl) ; // Закрываем соединение | |
$result = json_decode($result, 1) ; // Декодируем ответ | |
return $result; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment