Php 使用cURL模拟CodeIgniter表单提交

Php 使用cURL模拟CodeIgniter表单提交,php,curl,Php,Curl,问题在于按下提交按钮。这是我的密码: // init $init = curl_init(); $url = "http://localhost/test/register/"; // set option curl_setopt($init, CURLOPT_URL, $url); curl_setopt($init, CURLOPT_RETURNTRANSFER, true); curl_setopt($init, CURLOPT_POST, true); $data = ar

问题在于按下提交按钮。这是我的密码:

// init

$init = curl_init();

$url = "http://localhost/test/register/";

// set option


curl_setopt($init, CURLOPT_URL, $url);
curl_setopt($init, CURLOPT_RETURNTRANSFER, true);
curl_setopt($init, CURLOPT_POST, true);


$data = array(
'name' => 'mahmoud',
'email' => 'example@yahoo.com',
'password' => '134563',
'cpassword' => '134563',
'submit' => 'register'                     
);

curl_setopt($init, CURLOPT_POSTFIELDS, $data);

// execute

echo curl_exec($init);


// close

curl_close($init);
还有我的表格

<?php

echo form_open('register/validate');
echo validation_errors();

?>
<div>
    <span><label>name</label></span>
    <span><input name="name" type="text" class="textbox" value="<?php echo set_value('name'); ?>"></span>
</div>
<div>
    <span><label>email</label></span>
    <span><input name="email" type="text" class="textbox" value="<?php echo set_value('email'); ?>"></span>
</div>
    <div>
        <span><label>password</label></span>
        <span><input name="password" type="password" class="textbox"></span>
    </div>
    <div>
        <span><label>cpassword</label></span>
        <span><input name="cpassword" type="password" class="textbox"></span>
    </div>

    <div>
        <span><input type="submit" name="submit" value="register"></span>
    </div>
<?php

echo form_close();

?>
代码用值填充输入,但似乎没有按submit。为什么不呢

我正在使用CodeIgniter框架。

PHP是服务器端语言,无法与浏览器客户端交互


如果您只想发布数据,则可以将其发布到处理发布数据的URL。

您可以使用任何客户端语言(如Javascript)来操作浏览器