用隐藏的形式卷曲登录php

时间:2015-12-16 06:51:43

标签: php curl

我想在一些网站上使用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>

我如何使用隐藏的表单卷曲php(名称=&#34; requrest_token&#34;)

1 个答案:

答案 0 :(得分:0)

尝试使用它:

$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);