When we are submitting the form using the Form API of hubspot and then it is submitting the values. But when we use some special characters then the values are not entering properly.
For example: In the form on some text field we have written as "it's simple", but in the form submission of Hubspot it is showing like "it's simple"(backword slash is adding before single quote).
Please find the below screenshot for clear explanation of the issue.
I actually can't get as much information from a code snippet like this, since I don't have any insight into the value of those variables and I can't log the final result to see what the actual request would look like. Can you try logging the full string you end up with? I think it's likely that there are single quotes being escaped with a slash in some of your strings, and they're somehow being included in the final request.
//replace the values in this URL with your portal ID and your form GUID
$endpoint = 'https://forms.hubspot.com/uploads/form/v2/1746707/359b0079-a688-4e12-84db-74e2b4e5231a';
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $str_post);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded'
));
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = @curl_exec($ch); //Log the response from HubSpot as needed.
$status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE); //Log the response status code
@curl_close($ch)
I'm not able to reproduce this in my own portal. Can you give me an example request you're making to the Forms API? Is it possible that these quotes are being escaped improperly in whatever language you're using to submit to the Forms API?