Send form data to another script not working.

Home Forums Quform WordPress Send form data to another script not working.

This topic is: not resolved
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #12375
    MAXIS322718
    Participant

    Hello.
    Did everything as you described
    Send form data to another script
    Title
    Rewrite the post variables (optional)
    Here is the code functions.php

    function another_script($form)
    {
    // Rewrite the post variables
    $post = array(
    'name' => $_POST['iphorm_4_1'], // Change iphorm_X_X to name field unique ID

    );

    // Create a new cURL resource
    $ch = curl_init();

    // Set URL and other appropriate options
    curl_setopt($ch, CURLOPT_URL, 'http:/my-site.ru/script.php');
    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_4', 'another_script', 10, 1);


    Here is the code script.php

    <?php echo "name:".$_POST[name]."<br>"; ?>

    After submitting the form I get the file script.php empty
    name:
    cURL PHP extension enabled
    Please help me to understand what am I doing wrong?

    #12390
    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.

    #12399
    MAXIS322718
    Participant


    function my_form_redirect($url, $form)
    {
    $data = array(
    'name' => $form->getValue('iphorm_4_1'),
    'email' => $form->getValue('iphorm_4_2'),
    );

    $data = array_map('rawurlencode', $data);

    $url = add_query_arg($data, 'http://my-site.ru/script.php');

    return $url;
    }
    add_action('iphorm_success_redirect_url_4', 'my_form_redirect', 10, 2);

    Here is the refactored code from your example. The same script “script.php ” the result is empty
    name:
    I want to output the data to the remote script and display these data

    #12400
    MAXIS322718
    Participant

    Your suggested code above only works within Quform forms

    #12404
    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.

    #12407
    MAXIS322718
    Participant

    Thank You very much!!
    It worked, second amendment with the quotation marks work.
    Please tell me, and what data need first way Send form data to another script with curl?
    You have a very good product. I wish You that he would develop and become more functional and modern.

    #12435
    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.

    #12440
    MAXIS322718
    Participant

    How to use this script cURL method?

    #12442
    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.

Viewing 9 posts - 1 through 9 (of 9 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