I have a contact form which i want to integrate with my Hubspot, but i keep receiving this error message:
403 ERROR
The request could not be satisfied.
This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests.
Generated by cloudfront (CloudFront)
Request ID: zzXYHpy8twhlm2q4KvXwkig3hdEa5PobhB2UBh8umgMZK9MLo0J30A==
This is the code i am using, my browser is HTTPS and i tried with my local which is HTTP but none of them worked.
<?php
$arr = array(
'properties' => array(
array(
'property' => 'email',
'value' => 'testing@mailinator.com'
),
array(
'property' => 'firstname',
'value' => 'test'
),
array(
'property' => 'lastname',
'value' => 'test22'
),
array(
'property' => 'phone',
'value' => '0123654785'
)
)
);
$post_json = json_encode($arr);
$endpoint = 'https://app.hubspot.com/contacts/v1/contacts?hapikey=' . $hapikey;
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $post_json);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = @curl_exec($ch);
$status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
@curl_close($ch);
echo "curl Errors: " . $curl_errors;
echo "\nStatus code: " . $status_code;
echo "\nResponse: " . $response;
?>