2015-03-19 105 views
0

对我来说,唯一的问题是,它没有为形式的HTML按钮提交它使用的CSS风格的自定义按钮没有name属性。 这是形式登录到网站使用PHP和卷曲

<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); 
?> 
+0

你想要什么? – 2015-03-19 07:26:24

+0

我想登录该网站并获取会员区域页面的html。现在,它只是显示登录页面时,我抢即它不是洛我的 – 2015-03-19 07:27:12

+0

可能重复的内容(http://stackoverflow.com [如何通过由JavaScript即submited没有在提交表单按钮PHP的卷曲登录] /问题/ 24308683 /如何对登录贯通的PHP卷曲 - 这 - 是 - submited按JavaScript的IE浏览器没有提交对接) – 2015-03-19 07:29:37

回答

-1

更改类型一样,

method = 'get' 

在表单标签和php代码中使用

GET['username'],GET['password'] 
+0

我无法编辑登录网站。 – 2015-03-19 07:38:57