Insert Data Form Randomized


#1

Hi, I have a php script that inserts data into hubspot.
The problem is that the information takes several hours to appear instead of being almost instantaneous.

I insert the data through curl
The code is the next:

$endpoint = 'https://forms.hubspot.com/uploads/form/v2/formid/appid';
$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','Expect:'));
@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 would like to know if you can help me solve this problem.


#2

I answer myself.

When you send many post requests to the same url on hubspot, it collapses, and the requests are digested as it can.

It is best to limit the number of submissions you make to the form if possible and if you have cron, increase the time of execution, otherwise they will appear randomly.