Bitrix24 Community

Support » Forum » CRM » REST API I can not run the rest.php example for a contact form in wp
Pages: 1
REST API I can not run the rest.php example for a contact form in wp

I am new in the use of php. I have tried to execute the example of contact form rest.php in my wordpress site through page template but does not work. Neither it works if I call directly the rest.php page in the browser, always obtain the same error first and then the form. Can anybody help and say me what am I doing wrong?

This is what i get:

$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 ?>Title*:
Company Name:
First Name:
Last Name:

Thank in advance.
Hi Francisco

If you are using WordPress and would like to receive leads from a website site to your Bitrix24 CRM, please read this
Pages: 1
are already using Bitrix24