我嘗試使用javascript提交流程來捲曲頁面,但沒有任何運氣......所以我要求社區提供一些幫助!捲曲和javascript提交
這裏是形式:
<script>
<!--
function vallogin(){
document.formlogin.action = "./index.php?vallogin=1";
document.formlogin.submit();
}
-->
</script>
<form name="formlogin" method="post">
<div class="headerblocgris">
<span class="txtnoir12">| Accès |</span>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txtnoir12">Login</td>
<td><input name="txtlogin" type="text" size="15" /></td>
<td><span class="txtnoir12">Password</span></td>
<td>
<input name="txtmdp" type="password" size="15" />
<input type="image" name="vallogin" src="images/bt_go.gif" align="absmiddle" />
</td>
</tr>
</table>
</form>
我的捲曲功能:
{
/**
* Connexion
*/
$URL = 'http://www.affiliatevista.com/index.php?vallogin=1';
$data = array(
'txtlogin' => $this->login,
'txtmdp' => $this->passe,
'formlogin' => '',
'vallogin' => '',
);
curl_setopt($this->ch, CURLOPT_URL, $URL);
curl_setopt($this->ch, CURLOPT_HEADER, true);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->implode_array($data));
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->_getCookie());
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->_getCookie());
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
$String = curl_exec($this->ch);
echo $String;
}
感謝您的輸入,上面的代碼不驗證的形式,我覺得我會錯過什麼用提交驗證過程...
表單不是我的,而是我想要的一個網站e捲曲函數http://www.affiliatevista.com/,因爲你可以看到它們不會在輸入內添加onclick,所以我必須處理它並調用curl內的vallogin不是嗎? – 2011-03-01 23:25:21
@henri你已經在那裏迷失了我。你不能在php中執行javascript。一個是客戶端,另一個是服務器端。你的意思是你沒有訪問JavaScript和HTML,所以你試圖從服務器調用提交功能? – 2011-03-01 23:50:02
因此,如果我明白我不能使用表單驗證javascrip的CURL,即使我找到表單驗證的目標:/index.php?vallogin=1?感謝邏輯單元! – 2011-03-02 11:34:50