willsavin Posted February 21, 2009 Share Posted February 21, 2009 Hi all, I have been repeatedly getting the same error messages on this <?php $inputbeforeparse = $_SERVER['PHP_SELF']; $input = fopen($inputbeforeparse, "r"); $data = preg_match("/<title>[\/\(\)-:<>\w\s]+<\/title>/",$cnt,$input); $data2 = str_replace("HotWaterSA |", "", $data); echo $data2; ?> It returns with "Warning: fopen(/testingtesting.php) [function.fopen]: failed to open stream: No such file or directory in /home/corocco/public_html/testingtesting.php on line 21 0" I thought it may be a fopen problem so i tried this <?php $inputbeforeparse = $_SERVER['PHP_SELF']; $input = file_get_contents($inputbeforeparse); $data = preg_match("/<title>[\/\(\)-:<>\w\s]+<\/title>/",$cnt,$input); $data2 = str_replace("HotWaterSA |", "", $data); echo $data2; ?> but it returned a similar error... Any ideas? Thanks all Link to comment https://forums.phpfreaks.com/topic/146228-fopen-problems/ Share on other sites More sharing options...
haku Posted February 21, 2009 Share Posted February 21, 2009 The file isn't in the folder you are specifying. Either that or you have the chmod on it set to not be able to be read. But I suspect you have your filepath wrong. Link to comment https://forums.phpfreaks.com/topic/146228-fopen-problems/#findComment-767700 Share on other sites More sharing options...
willsavin Posted February 21, 2009 Author Share Posted February 21, 2009 Thanks for your reply I am using the PHP_SELF function so this problem dosen't happen.. The file path is correct, I have double-checked! I am wondering whether this problem is to do with php safe_mode? I don't know whether or not it is on. Could this be the problem? Thankyou again! Link to comment https://forums.phpfreaks.com/topic/146228-fopen-problems/#findComment-767712 Share on other sites More sharing options...
haku Posted February 21, 2009 Share Posted February 21, 2009 I just went back and looked at the code, and you are trying to use fopen on the file that is calling fopen. That doesn't really make sense. What is the file you are trying to open? Link to comment https://forums.phpfreaks.com/topic/146228-fopen-problems/#findComment-767717 Share on other sites More sharing options...
willsavin Posted February 21, 2009 Author Share Posted February 21, 2009 Thanks Haku for your speedy reply Yes, you are right, I am trying to get the source of the current page so i can find the title tags contents.. Is there a problem with retrieving data from the current page? Thanks Link to comment https://forums.phpfreaks.com/topic/146228-fopen-problems/#findComment-767718 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.