PHP wizard needed
Greg Rundlett
greg at freephile.com
Wed Oct 27 16:14:01 EDT 2004
Hi Travis,
Obviously you already have a solution, but for the sake of answering it
with a PHP script:
If you wanted to do this in your PHP script (because you needed to do a
lot of extraction, formatting, inserting into a database or other file
etc.) you could use the perl-compatible regular expression functions
that are built-in to PHP:
Something like
$contentFile = $_SERVER['DOCUMENT_ROOT'] . 'public_html/path/to/file.html';
$searchPattern = '|<TD WIDTH="170">([^<]*)</TD>|imUs'; // imUs are regex
options see the manual
$rawcontents = implode( '', file($contentFile) ); // could use fopen()
here too
$boolFound = preg_match_all($searchPattern, $rawcontents,
$arrPercentiles); // matches end up in $arrPercentiles
if ($boolFound) {
echo '<pre>';
print_r ($arrPercentiles);
echo '</pre>';
}
else {
echo 'No results found while searching for percentiles';
}
- Greg
--
FREePHILE
We are 'Open' for Business
Free and Open Source Software
http://www.freephile.com
(978) 270-2425
If you are smart enough to know that you're not smart enough to be an
Engineer, then you're in Business.
More information about the gnhlug-discuss
mailing list