Jump to content

php ob_get_contents


keeve

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/
Share on other sites

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..

Link to comment
https://forums.phpfreaks.com/topic/67736-php-ob_get_contents/#findComment-340310
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.