I want to combine these two following actions, can anyone help me? I want to perform two actions on one click on the submit button!
Action No.1:
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
Action No.2:
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login2.php', 'login_post2' ) ); ?>" method="post">
I want to send data to two different scripts, thats why I unable to combine them, when I try to combine them, it will send data to one form not both. I want combine both in such a way that it will send the data to both scripts..
You could try using a custom action as the target and use cURL to make the two requests
<?php
$targets = array('http://example.com/wp-login-one.php',
'http://example.com/wp-login-two.php');
$cookie = 'cookie.txt'; // MUST be writable to script
$postdata = '';
foreach($_POST as $key => $value){
$postdata .= '&'.$key.'='.$value;
}
foreach($targets as $url){
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Put your desired User Agent here");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
curl_close($ch);
echo $result;
}
?>
This is untested code - pretty sure it wuld work though - if need be I can further refine it to get to work in the wild!