Here is an example:

------------------------------------------

$filename = "thefile.doc";
$fd = fopen ( $filename, "r" );
$contents = fread ( $fd, filesize($filename) );   ## contents of file are
now in a string
fclose ($fd);

## now, since you have contents of file in string $contents, you can use
regex to search for keywords

$keyword = "name";

## eregi is the non-case-sensitive way to search strings.
## you can also use the perl regex: preg_match so that you can use perl-like
regexes ( /$pattern/i ), etc.

if( eregi( $keyword, $contents ) )
 echo "The word \"name\" has been found.<br>";
else
 echo "The word \"name\" has not been found.<br>";

------------------------------------------

Again, go to php.net and look up all the possible ways to search strings.

good luck,
Nicole Amashta
www.aeontrek.com

"Todd Williamsen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> interesting...  cool eh?
>
> i will give it a whirl...
>
> now I got to figure out the regex function
>
>
> "Nicole Amashta" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I made a test file in word. It's funky, but it still has the actual text
> in
> > ascii. You should - just an assumption - be able to open the doc with
php
> > and read through the file doing a keyword search.
> >
> > Can't hurt to experiment with it.
> >
> > good luck,
> > Nicole Amashta
> > www.aeontrek.com
> >
> >
> > "Todd Williamsen" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Nicole,
> > >
> > > I have no idea if its ASCII formatted or not.  I wonder if there is a
> way
> > to
> > > find out?
> > >
> > >
> > > "Nicole Amashta" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > OK, I am not exactly sure of the format of word docs off hand. But
if
> > they
> > > > are an ascii format, you can just read through the file using PHP
and
> > use
> > > > regular expressions to search for the words. Just a suggestion.
> > > >
> > > > That's just if it's ascii format. Read the whole file into a string,
> > then
> > > > search the string with a regular expression function.
> > > >
> > > >
> > > > http://www.php.net/manual/en/ref.regex.php
> > > >
> > > > Here is some help on regex's if you don't know already.
> > > >
> > > > Nicole Amashta
> > > > Web App. Dev.
> > > > www.aeontrek.com
> > > >
> > > > "Todd Williamsen" <[EMAIL PROTECTED]> wrote in message
> > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > I have an application in which I would like to search MS Word docs
> > with
> > > > PHP
> > > > > and I am assuming with COM to perform this.  The Documents reside
on
> a
> > > > Linux
> > > > > box(for now).  Now I want to be able to search these documents
with
> > > > > keywords.
> > > > >
> > > > > Is this possible?  Where do I look to do perform this?  Will COM
run
> > on
> > > > > Linux or will php, mySQL will have to reside on a Windows
> application?
> > > > >
> > > > > Thanks!
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to