i have a small problem to read word file using php

dear friends ,
                        how can i read a wordfile(.doc) using php . i had  excel redear i can read form that all contant

                  can any one help me
srinut31Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

den4bCommented:
There are few open source tools on the net which can extract pure text from most of the MS Office formats. You can use them from within PHP to parse *.doc files.

* catdoc: http://wagner.pp.ru/~vitus/software/catdoc/
* word2x: http://word2x.sourceforge.net/

Both of these come as C/C++ source code, but catdoc has a complied version for DOS Real-Time mode, which runs fine on Windows.

* catdoc for DOS: http://ftp.wagner.pp.ru/pub/catdoc/catdoc-0.94.2.zip

(make sure you read the notes, for example: catdoc does not support long names, etc.)
0
srinut31Author Commented:
Thanks for your replay  i need to read a .doc file using php code
0
GuanoFunCommented:
Pretty sure you can't do that, since php has no way of recognizing Microsoft document filies directly.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

srinut31Author Commented:
is it possible to ajax to do
0
GuanoFunCommented:
well... you can always install something like den4b told you and execute it silently with php
0
den4bCommented:
You can use those tools (listed above) in PHP, via program execution functions:

http://php.net/exec

string exec ( string $command [, array &$output [, int &$return_var ]] )
string system ( string $command [, int &$return_var ] )
string shell_exec ( string $cmd )

Example below will print out the textual contents of "example.doc":
exec("catdoc.exe example.doc", $output);
echo $output;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
den4bCommented:
I use this exec method in PHP to index content of PDF, DOC, PPT files. Works perfectly. I doubt that you will ever find something pure-PHP based, that can extract content of *.doc files, because I've been looking for such code for a very long time without any luck.
0
Loganathan NatarajanLAMP DeveloperCommented:
You could not straight read and use the Ms-Word documents.... because you cannot identify the structure of the word document... better I would suggest to use XML way to read the data from the word file..   convert it into XML file then read the data ... that will give exact data to read ....
0
srinut31Author Commented:
hey logudotcom: can you explain  how can i do using XML .   So I can understand .
0
Loganathan NatarajanLAMP DeveloperCommented:
just save as the .doc ... into .xml ... then read the xml file through php...
0
Loganathan NatarajanLAMP DeveloperCommented:
if you don't have formatting in the .doc ... just save as .txt file... and read the contents.
0
Loganathan NatarajanLAMP DeveloperCommented:
It is better to consider do you really want to read the .doc file ... because it is very risky to read through php and process the .doc details... as php doesn't give full support functions to parse the .doc details... only read / open / close .doc file facility is  available...
0
CWS (haripriya)Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
  Delete - no points refunded

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

cyberwebservice
Experts Exchange Cleanup Volunteer
0
Loganathan NatarajanLAMP DeveloperCommented:
Possible solution was given to this question...
0
srinut31Author Commented:
Dear logudotcom,
                                There is problem with reading .doc format its supports COM+  services .Unix does not  have that services i think . still am searching  for that  only.  
                   
0
den4bCommented:
The only 100% working solution for extracting content of DOC files is to use command line tools, like catdoc.exe, as demonstrated in my previous posts.
0
GuanoFunCommented:
more or less /qft
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.