lundi 3 mars 2014

file_get_contents on Word Doc


Vote count:

0




I am using the following code attempting to find a "term" in a word document using PHP. Of course this is not a right way of opening a binary file like a word document, but the malformatted string in "$fileContent" is good enough for me. However, the "stripos" function is not working as expected when searching for a term that currently is inside the doc.



$fileContent = file_get_contents($filePath);
$posFileContent = stripos($fileContent,$term);
if ($posFileContent !== false) {
echo "Found!!";
$value += $FACTOR_SEC;
}


Observation: doing a var_dump on $fileContent shows the proper content of the doc, with its malformat issues of course, but still the term is there.



asked 30 secs ago






Aucun commentaire:

Enregistrer un commentaire