开发者

curl POST ( LOGIN )

I am trying to log into a website. I looked at online users from another account and no effect.

<?php 
ini_set('display_errors',1); 
error_reporting(E_ALL);

$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, 'http://www.exemple.com/login.php'); 
curl_setopt ($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); 
curl_setopt ($ch, CURLOPT_POST, 1); 
curl_setopt ($ch, CURLOPT_POSTFIELDS, "username=AlbinuteleZU&password=AlbinuteleZU&submit=Login"); 
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

$login = curl_exec($ch); 
if ($login === FALSE) {
    die(curl_error($ch));
}
curl_close ($ch); 

print_r($login) . "\n"; 
?>

HTML:

<div class="rowElem">
                <label>Username</label> 
                <input type="text" name="username" id="username" class="input" value="" size="20" tabindex="10" />

            </div>
            <div class="rowElem">
                <label>Password</label> 
                <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="20" />
            </div>
            <div class="rowElem">
                <label></label> 
                <开发者_开发知识库;input type="submit" value="Login" class="button-primary"/>
            </div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜