请问php如何模仿表单action跳转
一个表单:
a1.html
<form method="post" action="b.php">
<input type="submit" name="button" class="" value=""/>
</form>
用php实现表单填写:
a2.php
<?php
$url = 'http://localhost/test/b.php';
$params = "param=123&button="; //What will be posted
$user_agent = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch); //execut
curl_close ($ch);
?>
我想问的是,人家按submit后可以提交了,我解释完a2.php后,可并不能同a1.html一样实现action跳转,跳转到b.php。
请问如何实现?