02-05-2009, 07:51 AM
|
#28 (permalink)
|
|
The Contributor
Join Date: Feb 2009
Posts: 65
Thanks: 0
|
Well it seems I keep progressing on this.
PHP Code:
<?php
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$authenticate = $_POST['authenticate'];
$loginvars = "accountName=" . $username . "&password=" . $password;
define(WOW_LOGIN_URL, 'https://www.blizzard.com/login/login.xml?referer=http%3A%2F%2Fwww.wowarmory.com%2Fvault%2Fguild-bank-log.xml%3Fr%3DMy%2BRealm%26n%3DMy%2BGuild&loginType=com');
$ch = curl_init(WOW_LOGIN_URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $loginvars);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, '../hidden/cookie.txt');
$results = curl_exec($ch);
curl_close($ch);
if (strstr($results, "Invalid account name or password")) {
echo "Invalid account name or password<br>";
}
elseif (strstr($results, "Account name required")) {
echo "Invalid account name or password<br>";
}
elseif (strstr($results, "Password required")) {
echo "Invalid account name or password<br>";
}
elseif (strstr($results, "Authenticator code required")) {
echo "Invalid Authenticator code<br>";
}
elseif (strstr($results, "Login failed")) {
echo "Invalid account name or password<br>";
}
elseif (strstr($results, "Authenticator Code")) {
$loginauth = "authValue=" . $authenticate;
$ch = curl_init(WOW_LOGIN_URL);
curl_setopt($ch, CURLOPT_COOKIEFILE, '../hidden/cookie.txt');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $loginauth);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, '../hidden/cookie.txt');
$results = curl_exec($ch);
curl_close($ch);
echo $results;
}
else {
echo $results;
}
}
else {
?>
<html>
<body>
<form action="banklog.php" id="loginForm" method="post">
Account Name<input id="username"name="username" type="text" /><br>
Password<input id="password" name="password" type="password" /><br>
Authenticator<input id="authenticate" name="authenticate" type="text" /><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
<?php
}
?>
My earlier mistake was in forgetting the CURLOPT_USERAGENT.
Now I am on the other side of this I can get it to work with my authenticator but I don't think it will work for those that don't have one as the CURLOPT_USERAGENT is not set in the first curl options. When I put it in there it I can't login with my authenticator.
|
|
|
|