Here is a Stack Overflow question that will get you started:
http://stackoverflow.com/questions/188452/reading-writing-a-ms-word-file-in-php[
^]
Once you are able to read the Word document, you just need to then write it out to a text file.
This will not be an easy process, nor will it be a completely accurate process. You will get close but I would be shocked if you ever got a fully-working solution that was 100% accurate. Converting Word documents is not simple, and doing it in php makes it tougher.