Curl登录php与隐藏的形式


Curl login php with hidden form

我想对某些站点使用curl。但该网站需要一个隐藏的表单。表单HTML是这样的:

<form method="get" name="login" action="example.com/procced.php">
    <input id="username" type="text" name="username" placeholder="Your email address" required /><br/>
    <input id="password" type="password" name="password" placeholder="Password" required />
    <input type="text" name="request_token" id="request_token" value="5433db648b28c3aaffcf63e650541c37aaa34614" style="display: none"/>
    <input type="submit" id="submit" value="Log in" />
</form>

我如何用隐藏的表单(name="requrest_token")卷曲php

尝试使用这个:

$url = "otherwebsiterul";  // url where you want to access 
$data = $_POST; // your form data as you want to pass.
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
curl_exec($handle);