brendanb Posted September 17, 2012 Share Posted September 17, 2012 hi there i had a website built for me a while ago and all has been good apart from my host has now disabled fopen... whatever that is.... so whats happened is that my website seems to have lost the path to my template. my host has said i need to find a replacement to the following line which is in a file called global.php: ----------------------------------------------------------- $file="common/matter.php"; $handle=fopen($file,"rb"); ----------------------------------------------------------- Does anyone have any ideas on what i am to do? the below is what is in my pages that i am guessing set the base url and call the template? include("global.php"); $base="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $base=substr($base,0,(strrpos($base,"/")+1)); $base=$base."common/"; $base="<base href=\"$base\">"; many thanks brendan Quote Link to comment https://forums.phpfreaks.com/topic/268460-disabled-fopenn/ Share on other sites More sharing options...
Christian F. Posted September 17, 2012 Share Posted September 17, 2012 The $base variable has nothing to do with the PHP code. All it does is to set the <base href=""> tag for the browser to read. As for your issue, you'll want to look at either file_get_contents () or file (). Depending upon how you want to use the contents of the file. Though, if that file contains PHP code then you're doing it wrong, and should be using require_once () or include () instead. PS: Please use the tags around your code, as it helps make both your post and your code a lot easier to read. Quote Link to comment https://forums.phpfreaks.com/topic/268460-disabled-fopenn/#findComment-1378547 Share on other sites More sharing options...
brendanb Posted September 17, 2012 Author Share Posted September 17, 2012 thanks for the reply. i kniow nothing of php etc so i dont understand what u are meaning but i will search for what you have mentioned and see what i can find so i guess the line i need to replace is $handle=fopen($file,"rb"); with either file_get_contents () or file () ?? thanks Quote Link to comment https://forums.phpfreaks.com/topic/268460-disabled-fopenn/#findComment-1378549 Share on other sites More sharing options...
Christian F. Posted September 17, 2012 Share Posted September 17, 2012 The PHP manual contains all of the information you need, so I recommend starting there. You can easily search for things in it by using the name after "php.net/". Like this: php.net/file_get_contents Quote Link to comment https://forums.phpfreaks.com/topic/268460-disabled-fopenn/#findComment-1378737 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.