php - Find sepecific text in multiple word document files -


i want build search module in user enter text , text should search files in particular directory. have used code :

$path_to_check = 'e:/xampp/htdocs/talent_orbit/test/'; $needle = 'test';  foreach(glob($path_to_check.'*.txt') $filename) {    //print_r(file($filename));   foreach(file($filename) $fli=>$fl)   {       echo $f1;     if(strpos($fl, $needle)!==false)     {       echo $filename.' on line '.($fli+1).': '.$fl;     }   } } 

but works .txt file, should search in .doc file. have change glob($path_to_check.'*.txt') $filename) glob($path_to_check.'*.doc') $filename) not show result. please me in this.

edit :

i tried ont solution this

php > exec("egrep -rl 'string of want find' full-or-relative-directory", $output); php > print_r($output); array (   [0] => full-or-relative-directory/foo/bar.xml ) php > $contents = file_get_contents($output[0]); 

it shows array(),i dont know put between "full-or-relative-directory" mean path.

my code :-

php > exec("egrep -rl 'rakesh' e:/xampp/htdocs/talent_orbit/test/", $output); php > print_r($output); 

if not possible can convert doc file txt file , search in txt file ?

thanks in advance.

this not possible. doc file isn't 'plain text' file. try opening in editor , see. searching through *.txt , *.xml files work, because plaintext files. doc file has binary data in it.

a solution doc-parser php (for example this one), require script loops through files, open each , every file parser , search string.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -