Re: Validation class method (ssn)

From: Date: Thu, 06 Jun 2002 21:13:48 +0000
Subject: Re: Validation class method (ssn)
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6762@lists.php.net to get a copy of this message
On Thu, 6 Jun 2002, Tim Gallagher wrote: > Brent, > > here is your function (which is really slick) except it sets the values > into an array. > > -timmyg While it is nice to have this as an array already, we probably don't want to make the validating function dependent on the ssa website or this script continually working. So, taking a snapshot of the data and writing it to a 'static' array seems more prudent, e.g. from the command line, run php get_highgroups.php > high_ssn_list.php Though the validation function just wants the array of high group numbers, so it doesn't really matter how you get it. - Brent > $document = implode('', > file('http://www.ssa.gov/foia/highgroup.htm')); > > $search = array ("'<script[^>]*?>.*?</script>'si", // Strip > out javascript > "'<[\/\!]*?[^<>]*?>'si", // Strip > out html tags > "'([\r\n])[\s]+'", // Strip out white > space > "'&#(\d+);'e"); // evaluate as php > > $replace = array ("", > "", > "\\1", > "chr(\\1)"); > > $text = explode("\n", str_replace ('*','', preg_replace ($search, > $replace, > $document))); > > for ($a = 0; $a < count($text) ; $a++) { > $line = trim($text[$a]); > if ((strlen($line) == 3) && is_numeric($line)) { > $out[$line] = trim($text[$a+1]); > $a++; > }; // end if > }; // end for loop > > print_r($out); >

« previous php.pear.dev (#6762) next »