eldan88 Posted May 23, 2014 Share Posted May 23, 2014 Hey Guys. I am trying to write to an HTML and attach that file for an efax API. One of the file types they accept is HTML, but it has to be in a <base> tag format. I am a little confused on how to do that. I tried to use fopen with the base tag but it didn't seem to work for me. I got the following error Warning: fopen(<base a href='96401.html'></base>) [function.fopen]: failed to open stream: No such file or directory Ideally what I am trying to accomplish is creating a file that just says 96401.html. Below is the code that I have tried it with. Any help would be really appreciated!!! $orderFile = "<base a href='".$id.".html'></base>"; // File name to be created. order id is used as a file name e.g. 123456.html //$fh = fopen($orderFile, 'w') or die("can't open file"); // Create and Save the writeable File //fwrite($fh, $order_information); // Write email contents to created file. Quote Link to comment Share on other sites More sharing options...
joel24 Posted May 23, 2014 Share Posted May 23, 2014 you need to specify a file path for fopen, not the content. It will attempt to create the file if it does not exist and you use 'w' as the second argument. $fp = fopen('data.txt', 'w');fwrite($fp, '1');fwrite($fp, '23');fclose($fp); http://www.php.net/manual/en/function.fwrite.php Quote Link to comment 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.