<?


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://adm.solucionati.ca/api/leads',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('name' => "$_POST[nome]",'source' => '3','status' => '18','hash' => '42fc8d30ac5bb8ccc8a6c23e82f73bb8-340d994c2373e2f34f8538aeff49359d','email' => "$_POST[email]",'phonenumber' => "$_POST[numero]"),
  CURLOPT_HTTPHEADER => array(
    'authtoken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoic2l0ZSBhcGkiLCJuYW1lIjoiU0lURSBBUEkiLCJwYXNzd29yZCI6bnVsbCwiQVBJX1RJTUUiOjE2NjY5MDA2Mzd9.XGGoneC3nzH1DK0YD-rS7NmuQnVGe-XnuVzG16myrQ8',
    'Cookie: sp_session=412c4068636c258e42ec355226a37c41d04bfd1d'
  ),
));

$response = curl_exec($curl);

curl_close($curl);

# alterar a variavel abaixo colocando o seu email

$destinatario = "lucas@solucionati.ca";

$nome = $_REQUEST['nome'];
$email = $_REQUEST['email'];
$mensagem = $_REQUEST['mensagem'];
$numero = $_REQUEST['numero'];
$assuntoemail = "Site Solucionática";
 // monta o e-mail na variavel $body


 $curl = curl_init();

 curl_setopt_array($curl, array(
   CURLOPT_URL => 'https://solucionatica.bitrix24.com.br/rest/7/0aker86ilz2gndjo/crm.lead.add.json?',
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_ENCODING => '',
   CURLOPT_MAXREDIRS => 10,
   CURLOPT_TIMEOUT => 0,
   CURLOPT_FOLLOWLOCATION => true,
   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
   CURLOPT_CUSTOMREQUEST => 'POST',
   CURLOPT_POSTFIELDS => array('FIELDS[TITLE]' => "$_POST[nome]",'FIELDS[NAME]' => "$_POST[nome]", 'FIELDS[EMAIL][0][VALUE]' => "$_POST[email]", 'FIELDS[PHONE][0][VALUE]' => "$_POST[numero]", 'FIELDS[SOURCE_DESCRIPTION]' => 'Site Oficial - Solucionática'),
   CURLOPT_HTTPHEADER => array(
     'Cookie: BITRIX_SM_SALE_UID=0; qmb=0.'
   ),
 ));
 
 $response = curl_exec($curl);
 
 curl_close($curl);




$body = "=================================================" . "\n";
$body = $body . "FALE CONOSCO - Site Solucionática" . "\n";
$body = $body . "=================================================" . "\n\n";
$body = $body . "Nome: " . $nome . "\n";
$body = $body . "Email: " . $email . "\n";
$body = $body . "Contato: " . $numero . "\n";
$body = $body . "LANDING PAGE: ". "https://solucionati.ca/site/ - Site Oficial" . "\n\n";
//$body = $body . "Mensagem: " . $mensagem . "\n\n";
$body = $body . "=================================================" . "\n";

// envia o email
mail($destinatario, $assuntoemail , $body, "From: $email\r\n");


// redireciona para a página de obrigado
header("location: obrigado.html");

?>