Re: Re: Searching MS Word Docs

From: Date: Mon, 11 Feb 2002 22:15:36 +0000
Subject: Re: Re: Searching MS Word Docs
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-11998@lists.php.net to get a copy of this message
<?php Function SearchMSW($filename,$find) { $fd = fopen( $filename, "rb" ); $contents = fread( $fd, filesize( $filename ) ); fclose( $fd ); $contents=bin2hex($contents); if (eregi($find, $contents))print "FOUND"; } #$find = binary code of what you are looking for, or use the line below for simple binary search #but in that case you do not need the bin2hex $find="Your text to find"; $find=bin2hex($find); #SearchMSW($filename,$find); SearchMSW("test.doc",$find); ?> Now, you are on your own... ;) Alain On Mon, Feb 11, 2002 at 04:05:08PM -0600, Todd Williamsen wrote: > Yes, create a function or if there is an existing one, use that. > > -----Original Message----- > From: alain [mailto:alain@sonic.net] > Sent: Monday, February 11, 2002 3:48 PM > To: Todd Williamsen > Cc: php-windows@lists.php.net > Subject: Re: [PHP-WIN] Re: Searching MS Word Docs > > > What do you mean? Create a function? > A+ > Alain > > On Mon, Feb 11, 2002 at 03:34:50PM -0600, Todd Williamsen wrote: > > Is there a way to automate that? > > > > -----Original Message----- > > From: alain [mailto:alain@sonic.net] > > Sent: Monday, February 11, 2002 3:20 PM > > To: Todd Williamsen > > Cc: php-windows@lists.php.net > > Subject: Re: [PHP-WIN] Re: Searching MS Word Docs > > > > > > Well, that's what the manual says. > > Once that you have the content of your file in a string, my advice is > to > > bin2hex it and search words or sentences using the hex representation > of > > it > > with ereg, as the word format is not plain binary, you will need to > hex > > edit > > your doc file to know what you are looking for. > > A+ > > Alain > > > > On Mon, Feb 11, 2002 at 12:38:59PM -0600, Todd Williamsen wrote: > > > Alain, > > > > > > I am running the "rb" but its on a Linux box so I think its ignoring > > it > > > > > > -----Original Message----- > > > From: alain [mailto:alain@sonic.net] > > > Sent: Monday, February 11, 2002 12:36 PM > > > To: Todd Williamsen > > > Cc: php-windows@lists.php.net > > > Subject: Re: [PHP-WIN] Re: Searching MS Word Docs > > > > > > > > > >From the manual - Last thing to read ;) > > > "Note: The mode may contain the letter 'b'. This is useful only on > > > systems > > > which differentiate between binary and text files (i.e. Windows. > It's > > > useless on Unix). If not needed, this will be ignored. " > > > A+ > > > Alain > > > > > > > > > On Mon, Feb 11, 2002 at 11:52:14AM -0600, Todd Williamsen wrote: > > > > Alain, > > > > > > > > I changed it from "r" to "rb" and it doesn't pick it up > > > > "Todd Williamsen" <todd@williamsen.net> wrote in message > > > > news:000a01c1b324$59e10c00$f6b2d83f@goofy1... > > > > > Alain.. > > > > > > > > > > That's fine... Hehe!! :) > > > > > > > > > > So would I just do a "rb" in the fopen statement then? > > > > > > > > > > -----Original Message----- > > > > > From: alain [mailto:alain@sonic.net] > > > > > Sent: Monday, February 11, 2002 11:48 AM > > > > > To: Todd Williamsen > > > > > Cc: php-windows@lists.php.net > > > > > Subject: Re: [PHP-WIN] Re: Searching MS Word Docs > > > > > > > > > > > > > > > Sorry, I didn't read all your posts, just the last one. If your > > > platform > > > > > is > > > > > not windoze, COM won't help you (neither ASP)... > > > > > You have to do a binary search in your Word file. > > > > > A+ > > > > > Alain > > > > > > > > > > On Mon, Feb 11, 2002 at 11:17:29AM -0600, Todd Williamsen wrote: > > > > > > That's great Alain... But as I previously posted its NOT > > windows, > > > and > > > > > if > > > > > > you read my post I have no idea how to use COM. > > > > > > > > > > > > So its not so easy > > > > > > > > > > > > -----Original Message----- > > > > > > From: alain [mailto:alain@sonic.net] > > > > > > Sent: Monday, February 11, 2002 11:15 AM > > > > > > To: Todd Williamsen > > > > > > Cc: php-windows@lists.php.net > > > > > > Subject: Re: [PHP-WIN] Re: Searching MS Word Docs > > > > > > > > > > > > > > > > > > If your server is win, it's pretty easy: Use COM. > > > > > > A+ > > > > > > Alain > > > > > > > > > > > > On Mon, Feb 11, 2002 at 10:45:22AM -0600, Todd Williamsen > wrote: > > > > > > > So is there a way to search within the MS Word docs even > > though > > > they > > > > > > are > > > > > > > binary, or do I need to look at ASP for this? I cannot run > > ASP > > > on > > > > > my > > > > > > > server, host says you can, but it doesn't run.. > > > > > > > "B.A.T. Svensson" <B.A.T.Svensson@lumc.nl> wrote > > > > > > > in message > > > > > > > > > > > > > > news:27E647E5629ED211BF78009027289C6303C1B6C4@mail1... > > > > > > > > MS Word document are binary. > > > > > > > > > > > > > > > > From: Todd Williamsen > > > > > > > > > > > > > > > > >I have no idea if its ASCII formatted or not. I wonder > if > > > there > > > > > is > > > > > > a way > > > > > > > > to > > > > > > > > >find out? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >"Nicole Amashta" wrote in message > > > > > > > > > > > > > > > > >> 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. > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > PHP Windows Mailing List (http://www.php.net/) > > > > > > > To unsubscribe, visit: > > > > > > > http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > PHP Windows Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: > > > > http://www.php.net/unsub.php > > > > > > > > > > > > -- > > > PHP Windows Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.windows (#11998) next »