diff --git a/README b/README new file mode 100644 index 0000000..29dc53d --- /dev/null +++ b/README @@ -0,0 +1,22 @@ +bboschecker - check for new BB device OS releases +Copyright (C) 2007 troyengel + +About +===== +This utility utilizes the OS downloads webpage at BlackBerryFAQ.com, walking +through each carrier's OS download page searching for a match to the device +model specified. When found this tool will load the OS page itself and report +the "Applications" version(s) that it finds. + +Requirements +============ +- PHP webserver with cURL support (including SSL in cURL) compiled in + +Most Red Hat/Fedora/CentOS and Ubuntu distros have the proper cURL/PHP/SSL +support ready to run, and I'm sure there are many others as well ready to +go (SuSE, Slackware, etc.) - when in doubt check your phpinfo() output. + +License +======= +This code is licensed under the GPLv2. + diff --git a/bboschecker.php b/bboschecker.php new file mode 100644 index 0000000..69b89b5 --- /dev/null +++ b/bboschecker.php @@ -0,0 +1,192 @@ + + + + + BlackBerry Device OS Checker + + + +

BlackBerry Device OS Checker

+ +done.
\n"; + flush(); + + echo "Parsing carrier list for links... "; + flush(); + $link_array = array(); + $cnt_array = explode("\n", $carriers); + foreach ($cnt_array as $line) { + if (stristr($line, "www.blackberry.com")) { + // http://www.the-art-of-web.com/php/parse-links/ + $regexp = "]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; + if (preg_match_all("/$regexp/siU", $line, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + # $match[2] = link address + # $match[3] = link text + $link_array[$match[2]] = $match[3]; + } + } + } + } + echo "done.

\n"; + flush(); + + echo "Searching for OS releases for the BlackBerry $device

\n"; + flush(); + reset($link_array); + while (list($link, $title) = each($link_array)) { + echo "Checking $title...
\n"; + flush(); + $rim_page = getPage($link); + $rim_array = explode("\n", $rim_page); + $got_v = 0; + $got_c = 0; + $value = ""; + $code = ""; + foreach ($rim_array as $line) { + // get the value + if (stristr($line, $device)) { + $regexp = "(.*)<\/option>"; + if (preg_match("/$regexp/siU", $line, $match)) { + $got_v = 1; + $value = $match[1]; + } + } + // get the code + if (stristr($line, "type=\"hidden\" name=\"code\"")) { + $regexp = "value=\"([^\"]*)\"(.*)"; + if (preg_match("/$regexp/siU", $line, $match)) { + $got_c = 1; + $code = $match[1]; + } + } + } + if ($got_v && $got_c) { + echo "  Found one, retrieving product page...
\n"; + flush(); + $postvars = "productName=$value&code=$code"; + $os_page = getPage($RIM_DLURL, "POST", $postvars); + $os_array = explode("\n", $os_page); + foreach ($os_array as $osline) { + if (stristr($osline, "Applications:")) { + $result = preg_replace("/<(.*)>/siU", "", $osline); + echo "    $result
\n"; + } + } + } + sleep($RIM_SLEEP); + } + + echo "
All done!
\n"; + +} else { +?> + +Enter the model number ONLY of the device.
+(7290, 8100, 8320, 8800, etc.)
+
+
+ + +
+ +Note: This tool will only search carriers who
+host their downloads on www.blackberry.com
+ + + +
+Code: bboschecker on github
+Released under the GPLv2 license
+ + +