f



read file .docx or .doc in php?

SG93IHRvIHJlYWQgY2xlYW4gZGF0YSBmcm9tIC5kb2N4IG9yIC5kb2MgZmlsZT8KCiRmaWxlX3Vy
bD0iaHR0cDovL3d3dy5hYmMuY29tL3VwbG9hZC90ZXN0LmRvY3giOwokZG9jX2RhdGEgPSBmaWxl
X2dldF9jb250ZW50cygkZmlsZV91cmwpOwoKaXQncyBnaXZlcyBvdXQgcHV0IGxpa2UKCgYM77+9
VO+/vWHvv71i77+9bO+/vWXvv70g77+9Tu+/vW/vv71y77+9be+/vWHvv71s77+977+977+9HO+/
vRfDtgPvv73vv700w5YG77+9ASADbO+/vTTDlgbvv70BBQPvv73vv71hw7YD77+977+9Au+/vQvv
v73vv73vv70o77+9awrDtMO/w4Hvv70o77+977+9IO+/ve+/ve+/ve+/ve+/ve+/vTAGB++/vU7v
v71v77+9IO+/vUzvv71p77+9c++/vXTvv73vv73vv70C77+9DO+/ve+/ve+/ve+/ve+/vVBLAwQU
77+9Bu+/vQjvv73vv73vv70hCu+/veKAmsWgwrwTw7rvv73vv73vv70cAu+/ve+/vRPvv73vv73v
v71bQ29udGVudF9UeXBlc10ueG1sCgpob3cgdG8gZ2V0IGNsZWFuIGRhdGEgbGlrZSB0ZXh0IGZp
bGU/Pw==
0
Amit
4/24/2010 10:14:57 AM
comp.lang.php 32639 articles. 0 followers. Post Follow

4 Replies
2003 Views

Similar Articles

[PageSpeed] 15

Amit Prakash Pawar wrote:
> How to read clean data from .docx or .doc file?
> 
> $file_url="http://www.abc.com/upload/test.docx";
> $doc_data = file_get_contents($file_url);
> 
> it's gives out put like
> 
> �T�a�b�l�e� �N�o�r�m�a�l����ö��4Ö� l�4Ö���aö������(�k
> ôÿÁ�(�� ������0�N�o� �L�i�s�t���������PK�����!
> �‚Š¼ú��������[Content_Types].xml
> 
> how to get clean data like text file??

That's because it's not an ASCII file.  It's a binary format used by 
Microsoft Word.

If you're on a Windows server, you can use a COM object to open the 
file.  Otherwise, you'll have to find a PHP library which can read the 
document.  Goog luck - I haven't found one yet which doesn't have problems.

Your best bet is to just have Word save the file as a plain text.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
Jerry
4/24/2010 10:35:55 AM
In article 
<d4872e43-e4e4-412d-83d7-a46bf62b0d9d@o15g2000pra.googlegroups.com>,
 Amit Prakash Pawar <amitppawar2007@gmail.com> wrote:

> How to read clean data from .docx or .doc file?
> 
> $file_url="http://www.abc.com/upload/test.docx";
> $doc_data = file_get_contents($file_url);
> 
> it's gives out put like
> 
> ?T?a?b?l?e? ?N?o?r?m?a?l????�??4�? l?4�???a�??????(?k
> ���?(?? ??????0?N?o? ?L?i?s?t?????????PK?????!
> ?��1�4�????????[Content_Types].xml
> 
> how to get clean data like text file??

This would require you knowing and decoding Word's proprietary format.  
Unless you got Microsoft's internal documentation off the net or reverse 
engineered the format, that's not going to happen.  Use Word to output 
the file in plain text.  Then you'll be able to read it.

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]


0
Michael
4/24/2010 4:58:33 PM
Op 24-4-2010 12:35, Jerry Stuckle schreef:
> Amit Prakash Pawar wrote:
>> How to read clean data from .docx or .doc file?
>>
>> $file_url="http://www.abc.com/upload/test.docx";

sorry, we couldn't find that page

is what they are responding at www.abc.com.....

-- 
Luuk
0
Luuk
4/24/2010 5:02:52 PM
Luuk wrote:
> Op 24-4-2010 12:35, Jerry Stuckle schreef:
>> Amit Prakash Pawar wrote:
>>> How to read clean data from .docx or .doc file?
>>>
>>> $file_url="http://www.abc.com/upload/test.docx";
> 
> sorry, we couldn't find that page
> 
> is what they are responding at www.abc.com.....
> 

That's because the op doesn't know enough to use example.com.  He uses a 
real domain, instead.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
-1
Jerry
4/24/2010 5:49:56 PM
Reply: