Jump to content

[SOLVED] file_get_contents()


adam291086

Recommended Posts

I have a simple bit of code that gets the contents of a document and displays it. It work fine with a txt document but when i use a word documet it output

 

ÐÏࡱá>þÿ *,þÿÿÿ)

 

Is this because im using the wrong function? Any Ideas?

 

<html>
<head>

</head>
<body>
<?php






// Get a file into an array.  In this example we'll go through HTTP to get
// the HTML source of a URL.

$lines = file_get_contents('adam.doc');
echo $lines;


?>
</body>
</html>

 

 

 

 

 

 

Link to comment
Share on other sites

It's because word documents are not plain text.. file_get_contents() only displays what you see if you open the file in "notepad"

 

you'll need to google for reading php files in PHP as i know it's simple to create them but i havn't seen many people reading them in.

 

 

Regards

Liam

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.