php bitrix-rest crm.lead

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php bitrix-rest crm.lead相关的知识,希望对你有一定的参考价值。

<?php
//get the fields available to a lead
https://hoangweb-dev.bitrix24.com/rest/1/hnw8ye0l22f93im8/crm.lead.fields.json

/**
 * Get lead
*/
$queryUrl = 'https://hoangweb-dev.bitrix24.com/rest/1/hnw8ye0l22f93im8/crm.lead.get.json';
$queryData = http_build_query(array(  //send post data
 'id' => 2
));

/**
 * delete lead
 */
curl -s https://hoangweb-dev.bitrix24.com/rest/1/hnw8ye0l22f93im8/crm.lead.get.json \
  -H "Content-Type: application/json" -d '{"id": 2}'

/**
 * add lead
 */
$queryUrl = 'https://hoangweb-dev.bitrix24.com/rest/1/hnw8ye0l22f93im8/crm.lead.add.json';
$queryData = http_build_query(array(
 'fields' => array(
	 "TITLE" => $_REQUEST['first_name'].' '.$_REQUEST['last_name'],
	 "NAME" => $_REQUEST['first_name'],
	 "LAST_NAME" => $_REQUEST['last_name'],
	 "STATUS_ID" => "NEW",
	 "OPENED" => "Y",
	 "ASSIGNED_BY_ID" => 1,
	 "PHONE" => array(array("VALUE" => $_REQUEST['phone'], "VALUE_TYPE" => "WORK" )),
	 "EMAIL" => array(array("VALUE" => $_REQUEST['email'], "VALUE_TYPE" => "WORK" )),
 ),
 'params' => array("REGISTER_SONET_EVENT" => "Y")
));

$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 => $queryData,
));

$result = curl_exec($curl);
curl_close($curl);

$result = json_decode($result, 1);
if (array_key_exists('error', $result)) echo "Error saving lead: ".$result['error_description']."<br/>";

//list leads
crm.lead.list.json

# send data
array(
 	'order'=> ["STATUS_ID"=> "ASC" ],
	'filter'=> [
	  ">OPPORTUNITY"=> 0, 
	  "!STATUS_ID"=> "CONVERTED" ,
	  //Find lead by phone number
	  "PHONE": "555888"
	],
	'select'=> [ "ID", "TITLE", "STATUS_ID", "OPPORTUNITY", "CURRENCY_ID" ]
)

以上是关于php bitrix-rest crm.lead的主要内容,如果未能解决你的问题,请参考以下文章

Odoo 迁移

linux 安装多个PHP版本(php5.6 php7.1 php7.2 php7.3 php7.4 php8.0)nginx配置php多版本

php [guzzle php] guzzle php #php

php send.php php邮件模板#php

IntelliJ IDEA 11编辑php是,支持php文件名为.php5和.php4,如何设置能让其也支持.php呢?

如何从php5升级到php7