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