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 = "