…send data to and external crm…

Home Forums Quform WordPress …send data to and external crm…

This topic is: resolved
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #21813
    area97
    Participant

    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.

    #21850
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #21872
    area97
    Participant

    just updated to 2.0.1

    #21976
    area97
    Participant

    bump!

    #22055
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #22219
    area97
    Participant

    thanks alot. it works perfectly.

    #25065
    area97
    Participant

    dudes, 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.

    #25110
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #25258
    area97
    Participant

    no 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);

    #25259
    area97
    Participant

    nope! my fault, now it works perfectly. discard my latest post.
    sorry for the trouble.
    thanks

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy