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/");
?>`
