PHP request not running

I am trying to call a PHP endpoint to simulate an activation. The form requires a x-token for authentication. I am running this using mamp in localhost and the form refuses to run (it returns 200 so it does find the form but just does not ping the endpoint do anything). Does anyone know what I’m doing wrong here? I believe its something to do with the localhost but I’m unsure.

<?php
// this requests a new site to be made when run. 

$islive = 1;

$companyname = 'TestCompany';
$memberFirst = 'Luke';
$memberLast = 'J';
$email = '[email protected]';
$phone = "07375182757";
$memberlocation = 'United Kingdom';
$town = 'Roford';
$county = 'assak';
$theme = 'dark';
$colour1 = "880808";
$colour2 = "880808";
$companytype = 'Carpentry';
$services = 'Carpentry';
$box1 = 'We specialise in all types of **COMPANY_TYPE** services';
$box2 = 'We specialise in all types of **COMPANY_TYPE** services';
$cta = 'Do you want to start a new Building Or Renovation project in **COMPANY_COUNTY**?';
$data = array(
    "memberName" => $companyname,
    "firstName" => $memberFirst,
    "lastName" => $memberLast,
    "memberEmail" => $email,
    "memberPhone" => $phone,
    "memberAddress" => $memberlocation,
    "memberTown" => $town,
    "memberCounty" => $county,
    "theme" => $theme,
    "colour1" => $colour1,
    "colour2" => $colour2,
    "companyType" => $companytype,
    "services" => $services,
    "box1" => $box1,    
    "box2" => $box2,
    "cta" => $cta,
);
$headers = array(
    'X-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    // 'Content-Type: multipart/form-data'  
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "MYURL");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

if($islive == 0) {
    curl_setopt($ch, CURLOPT_CAINFO, "LOCALLOCATION/cacert.pem");
}

$response = curl_exec($ch);
$responsecode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if(curl_error($ch)) {
    $error = curl_error($ch);
}

curl_close($ch);

I have tried to change the code but it appears to be correct syntactically and produces no errors. Its like the request isnt reaching the endpoint file.