Jump to content

[SOLVED] Retrieve the outputted page


wob_b

Recommended Posts

Oh, I see. Well you can do something like this:

 

<?php
session_start();
ob_start();

echo <<<END
All your page's output here
END;

$_SESSION['var'] = ob_get_contents();
?>

 

$_SESSION['var'] will then include everything that was output on the page.

Link to comment
Share on other sites

alex never seen ob_start() after the session_start is that new?

 

 

sorry i get it works with the ob_start();

 

then

 

ob_get_contents to get what in between the two functions.

ob_start() isn't related to session_start(), ob_start() is just to turn output buffering on so that you can catch all the output of the page and set it to a session variable later on through ob_get_contents().

 

Check them out, ob_start(), ob_get_contents()

Link to comment
Share on other sites

but , if ob_start() dose not go before the session_start() user's still get there errors.

 

that because they got HTML or wight spaces before session_start() i guess?

It doesn't matter either way because ob_start() doesn't output anything (So you won't get a headers already sent error if you call ob_start() first).

 

So..

 

session_start();
ob_start();

or

ob_start();
session_start();

 

There will be no difference.

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.