IMPORTANT UPDATE: Please DOWNLOAD and update the Formidable PRO2PDF to the Latest Version!

connection to bitrix crm

Home Forums Pre-Sale connection to bitrix crm

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #21017 Reply
    Duncan Standley
    Guest

    Hi there I was wanting to use your product to connect to bitrix24 crm. There is an address test a rest API. Can you confirm with this can be done or if your team can develop something for us. below is the code for a raw form that currently connects to the crm.

    https://nextwave.co.nz/listing-logic/rest.php

    <?
    // CRM server conection data
    define(‘CRM_HOST’, ‘crm.listinglogic.com’); // your CRM domain name
    define(‘CRM_PORT’, ‘443’); // CRM server port
    define(‘CRM_PATH’, ‘/crm/configs/import/lead.php’); // CRM server REST service path

    // CRM server authorization data
    define(‘CRM_LOGIN’, ‘duncan@nextwave.co.nz’); // login of a CRM user able to manage leads
    define(‘CRM_PASSWORD’, ‘Buddybid1’); // password of a CRM user
    // OR you can send special authorization hash which is sent by server after first successful connection with login and password
    //define(‘CRM_AUTH’, ‘e54ec19f0c5f092ea11145b80f465e1a’); // authorization hash

    /********************************************************************************************/

    // POST processing
    if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’)
    {
    $leadData = $_POST[‘DATA’];

    // get lead data from the form
    $postData = array(
    ‘TITLE’ => $leadData[‘TITLE’],
    ‘COMPANY_TITLE’ => $leadData[‘COMPANY_TITLE’],
    ‘NAME’ => $leadData[‘NAME’],
    ‘LAST_NAME’ => $leadData[‘LAST_NAME’],
    ‘COMMENTS’ => $leadData[‘COMMENTS’],
    );

    // append authorization data
    if (defined(‘CRM_AUTH’))
    {
    $postData[‘AUTH’] = CRM_AUTH;
    }
    else
    {
    $postData[‘LOGIN’] = CRM_LOGIN;
    $postData[‘PASSWORD’] = CRM_PASSWORD;
    }

    // open socket to CRM
    $fp = fsockopen(“ssl://”.CRM_HOST, CRM_PORT, $errno, $errstr, 30);
    if ($fp)
    {
    // prepare POST data
    $strPostData = ”;
    foreach ($postData as $key => $value)
    $strPostData .= ($strPostData == ” ? ” : ‘&’).$key.’=’.urlencode($value);

    // prepare POST headers
    $str = “POST “.CRM_PATH.” HTTP/1.0\r\n”;
    $str .= “Host: “.CRM_HOST.”\r\n”;
    $str .= “Content-Type: application/x-www-form-urlencoded\r\n”;
    $str .= “Content-Length: “.strlen($strPostData).”\r\n”;
    $str .= “Connection: close\r\n\r\n”;

    $str .= $strPostData;

    // send POST to CRM
    fwrite($fp, $str);

    // get CRM headers
    $result = ”;
    while (!feof($fp))
    {
    $result .= fgets($fp, 128);
    }
    fclose($fp);

    // cut response headers
    $response = explode(“\r\n\r\n”, $result);

    $output = ‘

    '.print_r($response[1], 1).'

    ‘;
    }
    else
    {
    echo ‘Connection Failed! ‘.$errstr.’ (‘.$errno.’)’;
    }
    }
    else
    {
    $output = ”;
    }

    // HTML form
    ?>
    <html>
    <head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
    </head>
    <?=$output;?>
    <form action=”rest.php” method=”post”>
    Title*: <input type=”text” name=”DATA[TITLE]” value=”” /><br />
    Company Name: <input type=”text” name=”DATA[COMPANY_TITLE]” value=”” /><br />
    First Name: <input type=”text” name=”DATA[NAME]” value=”” /><br />
    Last Name: <input type=”text” name=”DATA[LAST_NAME]” value=”” /><br />
    Comments: <textarea name=”DATA[COMMENTS]”></textarea><br />
    <input type=”submit” value=”Send” />
    </form>

    Hope this makes sense

    Cheers
    Duncan

Viewing 1 post (of 1 total)
Reply To: connection to bitrix crm
Your information: