Todd Dunning wrote:
Rob it's LAMP php5. Godaddy virtual dedicated. I'm considering if I should
just bite the bullet and attempt to build my first SQL db tonight, because
there's plenty of info about doing the basics via sql. I have phpMyAdmin
and cPanel. It's a classic noob issue of whether to spend extra time doing
it the right way or not.
Thanks very much for your interest in helping.
The following will do it without a database:
<?php
$file = 'your-file.csv';
$keywords = 'keyword1 keyword2 ...';
$keywords = preg_split( '# +#', $keywords );
$clauses = array();
foreach( $keywords as $keyword )
{
if( ($keyword = trim( (string)$keyword )) === '' )
{
continue;
}
$keyword = escapeShellArg( $keyword );
$clauses[] = "grep -s -i -F $keyword";
}
$matches = '';
if( $clauses )
{
$file = escapeShellArg( $file );
$command = "cat $file | ".implode( " | ", $clauses );
$matches = `$command`;
}
echo $matches."\n";
?>
You still need to parse your feed afterwards which I presumed was a CSV
or tab delimited style file WITHOUT newlines.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php