<?

$email = "berligo@me15.com";
$phone = "+972508965324";
$name = "Berlingo Meko";
$lname = "Meko";

leadInjection($email,$phone,$name);


// **** LEAD INJECTION ****
function leadInjection($email,$phone,$name) {
    
      $ip = $_SERVER['REMOTE_ADDR'];
      $dataname = explode(" ",$name);
      $fname = $dataname[0];
      $lname = $dataname[1];
      if ($lname == "") $lname = $fname;
    
    //$ip = "185.35.50.4";//$_SERVER['REMOTE_ADDR'];

    
    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => 'https://gm.gynmedias.com/api/signup/procform',
        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 => "{
            'ai': '2958065',
            'ci': '1',
            'gi': '40',
            'userip': '$ip',
            'firstname': '$fname',
            'lastname': '$lname',
            'email': '$email',
            'password': 'Ab12341234',
            'phone': '$phone',
            'so':'Ella_lp_1',
            'sub':'FreeParam',
            'MPC_1':'FreeParam',
            'MPC_2':'FreeParam',
            'MPC_3':'FreeParam',
            'MPC_4':'FreeParam',
            'MPC_5':'FreeParam',
            'MPC_6':'FreeParam',
            'MPC_7':'FreeParam',
            'MPC_8':'FreeParam',
            'MPC_9':'FreeParam',
            'MPC_10':'FreeParam'
        }",
        CURLOPT_HTTPHEADER => array(
            'x-trackbox-username: Anton',
            'x-trackbox-password: A1234567n',
            'x-api-key: 2643889w34df345676ssdas323tgc738',
            'Content-Type: application/json'
        ),
    ));

    $response = curl_exec($curl);

    curl_close($curl);
   echo $response;
}
