Home › Forums › Quform WordPress › Send form data to another script not working.
- This topic has 8 replies, 2 voices, and was last updated 10 years, 7 months ago by
Ally.
- AuthorPosts
- September 9, 2014 at 11:35 am #12375
MAXIS322718
ParticipantHello.
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?September 11, 2014 at 9:41 am #12390Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 11, 2014 at 11:56 am #12399MAXIS322718
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 dataSeptember 11, 2014 at 3:14 pm #12400MAXIS322718
ParticipantYour suggested code above only works within Quform forms
September 12, 2014 at 5:10 pm #12404Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 12, 2014 at 6:17 pm #12407MAXIS322718
ParticipantThank 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.September 16, 2014 at 5:02 pm #12435Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 16, 2014 at 5:17 pm #12440MAXIS322718
ParticipantHow to use this script cURL method?
September 16, 2014 at 6:40 pm #12442Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.