42 IT - YouTube

24

CRM -

5

24 CRM , . 3 , :

  1. - 24 . , , , , . . , .
  2. - 24. , , , Telegram, , Facebook, CRM .
  3. - CRM , . , REST API, PHP . CRM PHP .

24 , 24 .

  24 !

24

HTML :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<form action="integration.php" method="post">
	: <input type="text" name="tema" value="" /><br />
	 : <input type="text" name="companyname" value="" /><br />
	: <input type="text" name="name" value="" /><br />
	: <input type="text" name="lastname" value="" /><br />
	 : <textarea name="message"></textarea><br />
	<input type="submit" value="Send" />
</form>
</html>

, POST, PHP , 24. , integration.php

. PHP <?php ?>. php .

REST API , . 24 . :

//      24
define('CRM_HOST', 'your_domain.bitrix24.com'); //      
define('CRM_PORT', '443'); //   .     
define('CRM_PATH', '/crm/configs/import/lead.php'); //   PHP ,    .     

//  
define('CRM_LOGIN', 'login'); //  ,     
define('CRM_PASSWORD', 'password'); //   CRM

, CRM

$tema = $_POST['tema']; //           POST 
$companyname = $_POST['companyname'];
$name = $_POST['name'];
$lastname = $_POST['lastname'];
$message = $_POST['message'];

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

	//  
	$postData = array(
		'TITLE' => $tema,
		'COMPANY_TITLE' => $companyname,
		'NAME' => $name,
		'LAST_NAME' => $lastname,
		'COMMENTS' => $message,
	);

	//     
	if (defined('CRM_AUTH'))
	{
		$postData['AUTH'] = CRM_AUTH;
	}
	else
	{
		$postData['LOGIN'] = CRM_LOGIN;
		$postData['PASSWORD'] = CRM_PASSWORD;
	}

	//      CRM
	$fp = fsockopen("ssl://".CRM_HOST, CRM_PORT, $errno, $errstr, 30);
	if ($fp)
	{
		//  URL- 
		$strPostData = '';
		foreach ($postData as $key => $value)
			$strPostData .= ($strPostData == '' ? '' : '&').$key.'='.urlencode($value);

		//  
		$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;

		fwrite($fp, $str);

		$result = '';
		while (!feof($fp))
		{
			$result .= fgets($fp, 128);
		}
		fclose($fp);

		$response = explode("\r\n\r\n", $result);

		$output = '<pre>'.print_r($response[1], 1).'</pre>';
	}
	else
	{
		echo '    CRM '.$errstr.' ('.$errno.')';
	}
}
else
{
}

, , HTML , :

<?php echo $output;?>

. WEB :

 24

, CRM :

    24

CRM. -> . . , PHP:


?


: