- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Send values to form

May 8, 2018 11:29 AM
Hi everyone, i hope that someone could help me.
i have the next code:
$str_post = "email=" . urlencode($variables_lectura["email"]) . "&codigo_promocional=" . urlencode($variables_lectura["codigo_promocional"]) . "&firstname=" . urlencode($variables_lectura["firstname"]) .
"&phone=" . urlencode($variables_lectura["phone"]) . "&fecha_nacimiento=" . urlencode($variables_lectura["fecha_nacimiento"]) . "&sexo=" . urlencode($variables_lectura["sexo"]) .
"&address=" . urlencode($variables_lectura["address"]) . "&zip=" . urlencode($variables_lectura["zip"]) . "&city=" . urlencode($variables_lectura["city"]). "&state=" . urlencode($variables_lectura["state"])
."&country=" . urlencode($variables_lectura["country"]). "&tags=" . urlencode($variables_lectura["tags"]). "&fecha_creacion=" . urlencode($variables_lectura["fecha_creacion"]).
"&condiciones=" . urlencode($variables_lectura["condiciones"]). "&completa_id_dni=" . urlencode($variables_lectura["completa_id_dni"]). "&motivo_no_trabajo=" . urlencode($variables_lectura["motivo_no_trabajo"]).
"&tipo_contrato=" . urlencode($variables_lectura["tipo_contrato"]). "&company=" . urlencode($variables_lectura["company"]). "&job_title=" . urlencode($variables_lectura["job_title"]).
"&annual_revenue=" . urlencode($variables_lectura["annual_revenue"]). "&inversion_inf_300=" . urlencode($variables_lectura["inversion_inf_300"]).
"&patrimonio_trabajo=" . urlencode($variables_lectura["patrimonio_trabajo"]). "&residencia_unica_nacional=" . urlencode($variables_lectura["residencia_unica_nacional"]).
"&responsabilidad_publica=" . urlencode($variables_lectura["company"]). "&us_person=" . urlencode($variables_lectura["us_person"]). "&mobile_phone=" . urlencode($variables_lectura["mobile_phone"]).
"&estado_civil=" . urlencode($variables_lectura["estado_civil"]). "&tipo_actividad=" . urlencode($variables_lectura["tipo_actividad"]). "§or=" . urlencode($variables_lectura["sector"]) .
"&origen=" . urlencode($variables_lectura["origen"]);
$endpoint ="https://forms.hsforms.com/submissions/v3/public/submit/formsnext/multipart/portalid/formid";
$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);
echo $status_code . " " . $response;
echo "<br>".$str_post;
Actually, i've copied this code from "https://developers.hubspot.com/docs/methods/forms/submit_form" and this should send the values inside str_post to the form, however it is not happens. what's wrong?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content