Home › Forums › Quform WordPress › …send data to and external crm…
- This topic has 9 replies, 2 voices, and was last updated 5 years, 12 months ago by area97.
- AuthorPosts
- September 8, 2017 at 3:11 pm #21813area97Participant
hello, I’ve followed instructions from https://support.themecatcher.net/quform-wordpress/guides/integration/send-form-data-to-another-script
I can get email sent to me about submission, no errors, however the external crm is not updated.
this is the code I’ve used:
function my_post_to_another_script($form)
{
// Rewrite the post variables
$post = array(
'formSiLeads' => $_POST['iphorm_1_2'], // Change iphorm_X_X to name field unique ID
'nome' => $_POST['iphorm_1_3'], // Change iphorm_X_X to name field unique ID
'cognome' => $_POST['iphorm_1_4'], // Change iphorm_X_X to email field unique ID
'telefono' => $_POST['iphorm_1_5'], // Change iphorm_X_X to phone field unique ID
);// Create a new cURL resource
$ch = curl_init();// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://xxx.xxx.xxx/send?idprogetto=318');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));// Grab URL and pass it to the browser
curl_exec($ch);// Close cURL resource, and free up system resources
curl_close($ch);
}
add_action('iphorm_post_process_1', 'my_post_to_another_script', 10, 1);
I’ve also tried with code suggested here: https://support.themecatcher.net/forums/topic/form-get-to-external-url
without success.suggestions?
thank you.September 11, 2017 at 5:23 pm #21850AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 12, 2017 at 7:40 am #21872area97Participantjust updated to 2.0.1
September 18, 2017 at 9:02 am #21976area97Participantbump!
September 19, 2017 at 7:20 pm #22055AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 23, 2017 at 10:25 am #22219area97Participantthanks alot. it works perfectly.
April 18, 2018 at 9:33 am #25065area97Participantdudes, I’m tryng to make the same with another form, here’s both codes I’m using in functions.php. note: second modification, does nothing.
#funzione qform per postare su siseco form 2
function my_post_to_another_script(array $result, Quform_Form $form)
{
$data = array(
‘nome’ => $form->getValue(‘quform_2_6’),
‘cognome’ => $form->getValue(‘quform_2_7′),
’email’ => $form->getValue(‘quform_2_12’),
‘cellulare’ => $form->getValue(‘quform_2_14’),
‘citta’ => $form->getValue(‘quform_2_18’),
‘prov’ => $form->getValue(‘quform_2_20’),
);$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, ‘http://sileads.siseco.it/send?idprogetto=318’);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data, ”, ‘&’));
curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);if ($error && defined(‘WP_DEBUG’) && WP_DEBUG) {
Quform::log(‘cURL Error: ‘ . $error);
}return $result;
}
add_action(‘quform_post_process_2’, ‘my_post_to_another_script’, 10, 2);#funzione qform per postare su siseco form 9
function my_post_to_another_script2(array $result, Quform_Form $form)
{
$data = array(
‘cellulare’ => $form->getValue(‘quform_9_9’)
);$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, ‘http://sileads.siseco.it/send?idprogetto=352’);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data, ”, ‘&’));
curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);if ($error && defined(‘WP_DEBUG’) && WP_DEBUG) {
Quform::log(‘cURL Error: ‘ . $error);
}return $result;
}
add_action(‘quform_post_process_9’, ‘my_post_to_another_script’, 10, 2);suggestions?
thanks.April 23, 2018 at 12:13 pm #25110AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 26, 2018 at 8:54 am #25258area97Participantno way.
here’s again the whole code
#funzione qform per postare su siseco form 2
function my_post_to_another_script(array $result, Quform_Form $form)
{
$data = array(
‘nome’ => $form->getValue(‘quform_2_6’),
‘cognome’ => $form->getValue(‘quform_2_7′),
’email’ => $form->getValue(‘quform_2_12’),
‘cellulare’ => $form->getValue(‘quform_2_14’),
‘citta’ => $form->getValue(‘quform_2_18’),
‘prov’ => $form->getValue(‘quform_2_20’),
);$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, ‘http://sileads.siseco.it/send?idprogetto=318’);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data, ”, ‘&’));
curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);if ($error && defined(‘WP_DEBUG’) && WP_DEBUG) {
Quform::log(‘cURL Error: ‘ . $error);
}return $result;
}
add_action(‘quform_post_process_2’, ‘my_post_to_another_script’, 10, 2);#funzione qform per postare su siseco form 9
function my_post_to_another_script2(array $result, Quform_Form $form)
{
$data = array(
‘cellulare’ => $form->getValue(‘quform_9_9’)
);$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, ‘http://sileads.siseco.it/send?idprogetto=352’);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data, ”, ‘&’));
curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);if ($error && defined(‘WP_DEBUG’) && WP_DEBUG) {
Quform::log(‘cURL Error: ‘ . $error);
}return $result;
}
add_action(‘quform_post_process_9’, ‘my_post_to_another_script2’, 10, 2);April 26, 2018 at 8:56 am #25259area97Participantnope! my fault, now it works perfectly. discard my latest post.
sorry for the trouble.
thanks - AuthorPosts
- You must be logged in to reply to this topic.