[status_code] => 403 CAPTCH Problem

deals

#1

Hi,

I'm getting this error when trying to post inputs to HubSpot. It was working before and suddenly stop working. Have you any idea about it. Thanks...


One more step

Please complete the security check to access forms.hubspot.com

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this in the future?

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.

Cloudflare Ray ID: 4914e4cc2b9xxxx • Your IP: 94.73.146.xxx • Performance & security by Cloudflare

Please enable cookies.

And this is the code block which I use.

`  <?php

error_reporting(E_ALL);
// echo phpinfo();

//Process a new form submission in HubSpot in order to create a new Contact.

$hubspotutk = $_COOKIE['hubspotutk'];  //grab the cookie from the visitors browser.
$ip_addr = $_SERVER['REMOTE_ADDR'];  //IP address too.
$hs_context = array(
        'hutk' => $hubspotutk,
        'ipAddress' => $ip_addr,
        'pageUrl' => 'http://landing.webpage.com/',
        'pageName' => 'Contact Form'
    );
$hs_context_json = json_encode($hs_context);

//Need to populate these varilables with values from the form.
$uname=explode(' ',$_POST['firstname']);
$firstname=$uname[0];
$phonenumber=$_POST['phone'];

$str_post = "firstname=" . urlencode($firstname)
        . "&phone=" . urlencode($phonenumber)
        . "&hs_context=" . urlencode($hs_context_json);  //Leave this one be :)

 //replace the values in this URL with your portal ID and your form GUID
$endpoint = 'https://forms.hubspot.com/uploads/form/v2/5204xxx/986cfa8c-b706-4996-b41a-a4xxxxxxxx';
print_r($str_post);
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
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.
$info = curl_getinfo($ch);
print_r($info);
curl_close($ch);
echo $response;
print_r($response);

header("Location:http://landing.webpage.com/");

?>`

#3

Welcome, @ghorky.

This sounds similar to this issue, where the v2 Forms API endpoint will not accept submissions if reCAPTCHA is enabled in the UI.

Did you receive this error in HTML form (as opposed to just an HTTP response code). If so, could you share a screenshot of the error?

Also, could you share a link to the form in your HubSpot account? I'll redact the information once I receive it.


#4

Hi again, Yes i receive this error in html form. This is the screenshot of response code. It works on local or other servers.

https://forms.hubspot.com/uploads/form/v2/5204853/986cfa8c-b706-4996-b41a-a4439b0ae15b
https://share.hsforms.com/1mGz6jLcGSZa0GqRDmwrhWw33k39

Thanks...


#5

Did you make any changes to this form since posting a few hours ago? If not,

I successfully submitted the form three times through two different API client and created this contact. I didn't receive any error message.

If you are still receiving errors with your PHP code, could you try submitting manually through Postman or another client?


#6

Hi Again thanks for your answer. The error still continue it looks like cloudflare block my website ip. Postman will work because the code block already works on other platforms like localhost or another server with different ip.

I researhed the old topics and hubspot can't take my to on whitelist it's about Cloudflare.

Thanks for your help.


#7

Thank you for the information, @ghorky. That does seem like a Cloudflare block. Apologies I can't help more on that front.