Sending form data to another script

Home Forums Quform WordPress Sending form data to another script

This topic is: not resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25507
    cmsadmin
    Participant

    I’ve followed the documentation as described here: https://support.themecatcher.net/quform-wordpress-v2/guides/integration/sending-form-data-to-another-script

    The form values are being send to script.php in my child theme. How can I assign new variables to values from the ‘body’ array that wp_remote_post sends?

    And will my script.php run when it receives the data?

    // Frank

    #25512
    cmsadmin
    Participant

    After digging around I noticed that the body is not printed to debug.log. Therefore I think the body is not being send at all. Atleast this explains why I cannot acces the array in my script.php.

    add_action('quform_post_process_1', function (array $result, Quform_Form $form){
        $data = array(
            'forename' => $form->getValue('quform_1_5'),
            'surname' => $form->getValue('quform_1_6'),
            'email' => $form->getValue('quform_1_4'),
            'telephone' => $form->getValue('quform_1_7'),
            'street' => $form->getValue('quform_1_10'),
            'number' => $form->getValue('quform_1_11'),
            'zipcode' => $form->getValue('quform_1_8'),
            'city' => $form->getValue('quform_1_9')
        );
    
        $response = wp_remote_post('http://mywebsite/wp-content/themes/theme-child/script.php', array(
            'body' => $data
        ));
    
        if (defined('WP_DEBUG') && WP_DEBUG) {
            if (is_wp_error($response)) {
                Quform::log($response->get_error_message());
            } else {
                $code = wp_remote_retrieve_response_code($response);
                $body = wp_remote_retrieve_body($response);
    
                Quform::log('HTTP status code: ' . $code, $body);
            }
        }
      
        return $result;
    }, 10, 2);

    Results in this log:

    [06-May-2018 08:20:13 UTC] string(21) "HTTP status code: 200"
    
    [06-May-2018 08:20:13 UTC] string(0) ""
    • This reply was modified 7 years, 4 months ago by Ally.
    #25585
    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 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy