westman Posted July 23, 2012 Share Posted July 23, 2012 as some of you may know php has got a smail bug with $file_in_put = file_get_contents('../theflie.php'); when i 1st used it i had no prob. am trying to get 1 file (html) content in to a verible (the file can be .php or .html any that works)what is the next best way to do this? ps. yes i looked at...http://php.net/manual/en/function.file-get-contents.phpbut still no help Link to comment Share on other sites More sharing options...
birbal Posted July 23, 2012 Share Posted July 23, 2012 which bug are you refering to? what is happening when you run that code? Link to comment Share on other sites More sharing options...
Ingolme Posted July 23, 2012 Share Posted July 23, 2012 You can do the same thing using fopen(), fread() and fclose(), but if file_get_contents() isn't working I'd suggest finding the root of the problem and solving it. Link to comment Share on other sites More sharing options...
westman Posted July 24, 2012 Author Share Posted July 24, 2012 i just tryed...$handle = fopen("../email/theemail.php", "rb");$email_in_put = stream_get_contents($handle);fclose($handle); but it did not work, i am runing php 5.2 am trying to get html code from 1 file in my directy in to a verible.any help? Link to comment Share on other sites More sharing options...
Ingolme Posted July 24, 2012 Share Posted July 24, 2012 Can you explain what bug file_get_contents() has? I'm not aware of any. You're saying it doesn't work. What happens when you try the code? Are you getting an error message? Here's an example using fread(): $handle = fopen('../email/theemail.php', "rb");$email_in_put = fread($handle, filesize('../email/theemail.php') );fclose($handle); Link to comment Share on other sites More sharing options...
boen_robot Posted July 24, 2012 Share Posted July 24, 2012 Turn error display on, i.e. add ini_set('display_errors', 'On');error_reporting(E_ALL | E_STRICT); At the top of your PHP file. Chances are that there'll be some sort of message telling you why it doesn't work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now