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. Link to comment https://forums.phpfreaks.com/topic/288709-need-help-writing-to-an-html-file-using-base-tags/ 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 Link to comment https://forums.phpfreaks.com/topic/288709-need-help-writing-to-an-html-file-using-base-tags/#findComment-1480596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.