PHP code example of atlas89 / bitrix-createleads-api

1. Go to this page and download the library: Download atlas89/bitrix-createleads-api 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/ */

    

atlas89 / bitrix-createleads-api example snippets


composer 

$client = new \atlasBitrixRestApi\ClientBitrix($domain, $hook, $uri_api);

$client = new \atlasBitrixRestApi\ClientBitrix();
    $client->setDomain(test);
    $client->setHook("rest/1/q8khfywwh6a3c14n");
    $client->setUriApi("/crm.lead.add/");

$data = [
        "TITLE" => "Запрос с сайта",
        "NAME" => "Дима",
        "SECOND_NAME" =>"Петрович",
        "LAST_NAME"=> "Смолов",
        "CURRENCY_ID" => "USD",
        "OPPORTUNITY" => 12500,
        "PHONE" => [ 
                        [ "VALUE" =>"+375111111111", "VALUE_TYPE" => "WORK"],
                    ],
        "EMAIL" => [
                        ['VALUE' => "[email protected]", 'VALUE_TYPE' => 'HOME'],
                ],
        "COMMENTS" => "ПРИВЕТ НОВЫЙ ЛИД",
        "UTM_SOURCE" => "utm"
    ];

$response = $client->createLead($data); 
json_decode($response, true));

$client->setUriApi("crm.contact.list");
$response=$client->getContacts();

$filter_phone =[
                            "filter" => [
                                "PHONE" => "номер телефона",
                            ],
                            "select" => [
                                "ID"
                            ]
                        ];
$client->setUriApi("crm.contact.list");
$response=$client->getContacts(filter_phone);

$client->setUriApi("crm.lead.list");
$response=$client->getLeads();