There has been a updated program made please scroll down to see it in post 8 as this info is now out dated Well now that I have become a mod I guess I should cut down on the "not so good things" i do.. here is the php code for the item browser. you need to use on a php server that supports curl.
Here is how the url layout should look as well:
Code
http://www.YOURSITEHERE.com/bfh.php?page=50&username=BFHEMAIL&password=BFHPASS
replace YOURSITEHERE with your site of course.
replace BFHEMAIL with the email you login to BFH with (or alt account)
replace BFHPASS with your password you use.
where it says page=50 is where you choose what page you want to browse, it will display 100 links per page.
atm there seems to be a change in the html code on the webstore pages so the current bundles are not displaying, a quick look and tweak of the code of this will fix that.
enjoy!
- b00sted
Code
<html>
<head>
</head>
<body>
<?php
$userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6";
// INIT CURL
$ch = curl_init();
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL, 'https://www.battlefieldheroes.com/en/user/login?destination=/');
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'mail=' . $_GET['username'] . '&password=' . $_GET['password']);
// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL
# not to print out the results of its query.
# Instead, it will return the results as a string return value
# from curl_exec() instead of the usual true/false.
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
// EXECUTE 1st REQUEST (FORM LOGIN)
$store = curl_exec ($ch);
if(!isset($_GET['page'])){
$_GET['page'] = 1;
}
$num = $_GET['page'] * 100;
$begin = $num - 100;
$begin += 10000;
$num += 10000;
if(strpos($store, '<h2>Please make sure you fill in a correct email and password.</h2>') !== FALSE){
echo "<h3>You have supplied invalid login credentials</h3>";
} else {
echo "<h3>You are now viewing $begin to $num</h3>";
for($i=$begin; $i<$num; $i++){
$target_url = "https://www.battlefieldheroes.com/store/buy/$i";
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
$html = curl_exec($ch);
if ($html) {
$persona_pos = strpos($html, '<div class="select-persona">');
if($persona_pos !== FALSE){
$item_pos = strpos($html, '<div id="store-bundle">');
$start = strpos($html, '<h2>', $item_pos) + 4;
$end = strpos($html, '</h2>', $start);
$offset = $end - $start;
$message = '<span style="color: green;">' . substr($html, $start, $offset) . '</span>';
}
$insufficient_funds_pos = strpos($html, '<div id="lackingfunds"');
if($insufficient_funds_pos !== FALSE){
$start = strpos($html, '<p>', $insufficient_funds_pos) + 3;
$end = strpos($html, '</p>', $start);
$offset = $end - $start;
$message = '<span style="color: red;">' . substr($html, $start, $offset) . '</span>';
}
if(isset($message) && $message != ""){
echo "<a href='$target_url' target='_blank'>$target_url</a> - ";
echo $message."<br />";
flush();
}
}
}
}
// CLOSE CURL
curl_close ($ch);
?>
</body>
</html>