使用PHP和CURL登录到站点

使用PHP和CURL登录到站点,php,curl,Php,Curl,我唯一的问题是,它没有表单提交的html按钮,它使用的是css样式的自定义按钮,没有名称属性。 这是表格 <form name="login_form" method="post" action="index.php" onsubmit="loginFormSubmit(this)"> <div style="position:absolute;top:-1500px;"><input type="submit" value="sub"><

我唯一的问题是,它没有表单提交的html按钮,它使用的是css样式的自定义按钮,没有名称属性。 这是表格

<form name="login_form" method="post" action="index.php" onsubmit="loginFormSubmit(this)">
        <div style="position:absolute;top:-1500px;"><input type="submit" value="sub"></div>
        Username:<input name="username" size="20" maxlength="32"><br><br>
        Password:<input type="password" name="passwd" size="20" maxlength="32">
    </form>

用户名:

密码:
按钮的HTML代码,如果在标记之外

<div style="position: absolute; width: 54px; height: 20px; top: 382px; margin-left: 312px; cursor: pointer; color: rgb(255, 255, 255); font-style: normal; font-weight: normal;" onmouseover="fFOB(this)" onmouseout="fFNN(this)" onclick="loginFormSubmit(document.login_form)">Login</div>
登录
这是我的PHP代码

    <?php
$username="yyyyy"; 
$password="xxxxx"; 
$url="http://example.com/login.php"; 
$cookie="cookie.txt"; 
$postdata = "username=".$username."&passwd=".$password; 
$postdata = "username=$username&passwd=$password";

$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie); 
curl_setopt ($ch, CURLOPT_REFERER, $url); 

curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt ($ch, CURLOPT_POST, 1); 
$result = curl_exec ($ch); 

echo $result;  
curl_close($ch);
?>

更改类型,如

 method = 'get'
在表单标记和php代码中使用

GET['username'],GET['password'] 

我想登录到该网站并抓取会员区页面的html。现在它只是显示登录页面时,我抓取的内容,即它不是我的日志可能重复的错误是你得到?我没有得到错误,当我抓取的内容后,在它只是给我的登录页面的html,但我想要的成员区页面的html。