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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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