keeve Posted September 3, 2007 Share Posted September 3, 2007 im using the function ob_get_contents to get the contents of the whole page and save it to another file as .html My problem is that, in my first attempt to save the file, it would not update successfully but when i resave it several times and save it on the same file..it will then update the file successfully. can anybody help on this? i want that on the first attempt to save, it will save accordingly, thanks Quote Link to comment https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/ Share on other sites More sharing options...
trq Posted September 3, 2007 Share Posted September 3, 2007 You might want to post some code. Quote Link to comment https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/#findComment-340305 Share on other sites More sharing options...
keeve Posted September 3, 2007 Author Share Posted September 3, 2007 You might want to post some code. here are snippets of my codes, i can't post it all here since it is too long. //triggers the buffering ob_start(); .... print " <html> .... <span class=s3header>{$ws_data[WS_MASTER_INDEX][6]} Report</span> ... //there's more code here ............ $wsrepstr = ""; $wsrepstr = ob_get_contents(); ob_end_clean(); $fname = $fileName; $fname = "address{$fname}.htm"; $fp = fopen($fname,"w+"); fwrite($fp,"$wsrepstr"); fclose($fp); there.. i hope someone could help me.. Quote Link to comment https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/#findComment-340310 Share on other sites More sharing options...
vijayfreaks Posted September 3, 2007 Share Posted September 3, 2007 Hi.. I have copied code from ur post and try to run it.. after many updation.. it working fine.. Regards, Vijay Quote Link to comment https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/#findComment-340327 Share on other sites More sharing options...
keeve Posted September 3, 2007 Author Share Posted September 3, 2007 yes i believe my codes works fine.. but there's some factors which causes my prob:(. Why it does not saves on my first attempt? help:( Quote Link to comment https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/#findComment-340341 Share on other sites More sharing options...
Azu Posted September 3, 2007 Share Posted September 3, 2007 Try using touch() to create the file first. Quote Link to comment https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/#findComment-340391 Share on other sites More sharing options...
keeve Posted September 4, 2007 Author Share Posted September 4, 2007 does the length of codes affect the buffering? im also ccessing a distant database, does this also matters? prior to updating the file all inputs are first stored in the database, then later retrieved for updating the file. help Quote Link to comment https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/#findComment-340995 Share on other sites More sharing options...
keeve Posted September 4, 2007 Author Share Posted September 4, 2007 my file resides in a server. does that also affect the buffering? Quote Link to comment https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/#findComment-341055 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.