BlackBerry Device OS Checker

\n". "Device: $rimDevice
\n". "Network: $rimNetwork
\n". "Region: $rimRegion
\n". "
\n"; flush(); echo "Downloading carrier list from BlackBerryFAQ... "; flush(); chatty("\n
  URL:".$BBF_LIST."
\n"); $tx = new tableExtractor; $tx->source = file_get_contents($BBF_LIST); $tx->anchor = $BBF_ANCHOR; $tx->anchorWithin = false; $carrierArray = $tx->extractTable(); echo "done.

\n"; flush(); echo "Parsing carrier list for links... "; flush(); chatty("
\n"); reset($carrierArray); $link_array = array(); $reject_array = array(); foreach($carrierArray as $carrier) { if (($carrier['Network'] == $rimNetwork) || ($rimNetwork == "All")) { if (($carrier['Region'] == $rimRegion) || ($rimRegion == "All")) { if (stristr($carrier['Carrier'], "www.blackberry.com")) { // http://www.the-art-of-web.com/php/parse-links/ $regexp = "]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; if (preg_match_all("/$regexp/siU", $carrier['Carrier'], $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { # $match[2] = link address # $match[3] = link text chatty("\n  Adding: " . $match[3] . " (Network: " . $rimNetwork . ", Region: " . $rimRegion . ")
\n"); $link_array[$match[2]] = $match[3]; } // foreach link } // rexexp match } else { chatty("\n  Rejecting: " . $carrier['Carrier'] . " (not hosted on RIM server)
\n"); $reject_array[] = $carrier['Carrier']; } // blackberry.com match } // region match } // network match } // foreach carrier echo "done.

\n"; flush(); // output the list of sites to check by hand if (count($reject_array) > 0) { echo "These downloads are not hosted by RIM, check manually:
\n"; flush(); reset($reject_array); foreach($reject_array as $reject) { echo "  " . $reject . "
\n"; } echo "
\n"; } 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, $rimDevice)) { $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) { chatty("  Found one, retrieving product page...
\n"); $postvars = "productName=$value&code=$code"; $os_url = $RIM_DLURL . ", POST, " . $postvars; chatty("  URL Data: ".$os_url."
\n"); $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 { ?>
Device: 
Enter the model number ONLY of the device.
(7290, 8100, 8320, 8703, 8800, etc.)

Verbose Output:

Network:


Region:



Note: This tool will only search carriers who
host their downloads on www.blackberry.com

Code: bboschecker on github
Released under the GPLv2 license