Skip to content

Instantly share code, notes, and snippets.

@umkasanki
Created November 7, 2019 08:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umkasanki/ee3bf87dcd7d73586ff829b20adeb76c to your computer and use it in GitHub Desktop.
Save umkasanki/ee3bf87dcd7d73586ff829b20adeb76c to your computer and use it in GitHub Desktop.
Hubspot form
$data3 = array (
'fields' =>
array (
0 =>
array (
'name' => 'email',
'value' => 'example@example.com',
),
),
'context' =>
array (
'hutk' => '6f453d92607b8108998dc213178ad214',
'pageUri' => 'www.example.com/page',
'pageName' => 'Example page',
),
'legalConsentOptions' =>
array (
'legitimateInterest' =>
array (
'value' => true,
'subscriptionTypeId' => 999,
'legalBasis' => 'LEAD',
'text' => 'Legitimate interest consent text',
),
),
);
$dataEncoded = json_encode($data3);
$endpoint = 'https://api.hsforms.com/submissions/v3/integration/submit/' . $portalId . '/' . $currentFormId;
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $dataEncoded);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment