How do I post this form:
<form action ="http://google.com" id="checkpayment" style="display:none" method="post">
<input value="crm_pg1" name="uid">
<input value="98" name="passcode">
<input value="10" name="payamnt">
<input value="150001451" name="session">
<input value="demo@gmail.com" name="emailid">
<input value="9865321478" name="mobileno">
<input value="normal" name="paytype">
<input value="home" name="segment">
<input value="FTTH" name="sub_segment">
<input value="http://example.com" name="returnurl">
<INPUT TYPE ="SUBMIT">
</form>
and I am using this php code:
$curl_connection =
curl_init('http://google.com');
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, false);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
//perform our request
$result = curl_exec($curl_connection);
//show information regarding the request
print_r(curl_getinfo($curl_connection));
echo curl_errno($curl_connection) . '-' .
curl_error($curl_connection);
//close the connection
curl_close($curl_connection);
I don't know if it's working or not, but how do I post a form and redirect to form action?
For example if I posted this form using curl from my site ie; example.com and after successful submit its redirect to google.com.
First your action should be the php file you want to post the data from the form to. Second you can get the data from the form with $_POST in the .php file Third, after you make the call to api with curl you can redirect with header('Location: http://www.example.com/ ');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.