I’m trying to submit a Hubspot form via PHP and have ran into some problems.
What I’m running:
Wordpress server version 4.8
PHP version 5.6
Unable to use the
curl_initfunction, which is used here. Instead using
Tried submitting the form data as an associative array and as a URL string (as in the original instructions).
When submitting the data the
hs_contextas an associative array, I receive a
403: access deniederror.
When submitting the
hs_contextin JSON format, or not at all, the form successfully submits to Hubspot. The username, email, etc. are collected into the correct fields. However, the linked name is incorrect. For example, if I submit to Hubspot with the first name “Bob”, that name will show up in the first name field. But the associated name may show up as “John Smith”. I’ve attached images of examples.
Below is an example code snippet:
$response = wp_remote_post($endpoint, array( 'method' => 'POST', 'body' => $str_post ) );