Questions tagged [ob-start]

ob_start is a PHP function which turns output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

190 questions
2
votes
3 answers

HTML miss interpreted by browsers: Header-Content appears in Body - Why?

There is my source: As you can see the source is correct, but Firefox reports an error. Now look at the console of Firefox: There is a miss interpretation: The original content between the header tags (css, scripts) you can find in the body. Same…
user1711384
  • 343
  • 1
  • 7
  • 24
2
votes
2 answers

Equivalent funcion of PHP "ob" functions in Python/Django

Is there any function do the same result like PHP ob_start(myCallbackFunction) and ob_end_flush() that allow me modify the layouts and views in Python frameworks (Django/others)? thanks! UPDATE
user2678106
2
votes
1 answer

Remove repeating code in CodeIgniter functions

We are using CodeIgniter to wrap some internal functions and to display the results in json. Occasionally our internal functions might have debug strings printed to the screen. So we have started using output buffering to capture any debug and add…
2
votes
4 answers

ob_get_clean, only works twice

Take this simple script: ob_start(); $text = array(); echo 'first text'; $text[] = ob_get_clean(); echo 'second text'; $text[] = ob_get_clean(); echo 'third text'; $text[] = ob_get_clean(); echo 'fourth text'; $text[] =…
Drahcir
  • 11,772
  • 24
  • 86
  • 128
2
votes
1 answer

Code for attaching an image created from data to an e-mail and sending works in the test.php file but not in my main object function. What is wrong?

My php file gets passed image/png data and needs to attach it to an e-mail and send said e-mail. Here is working code from a test file:
Bil1
  • 440
  • 2
  • 18
2
votes
1 answer

ob_start Caching CSS

I'm using this php code to cache css files into a middle own CMS.
Danilo
  • 2,016
  • 4
  • 24
  • 49
2
votes
3 answers

php curl memory usage

I have this function that gets the html from a list of pages and once I run it for two hours or so the script interrupts and shows that memory limit has been exceeded, Now i've tried to unset/set to null some variables hopefully to free up some…
inrob
  • 4,969
  • 11
  • 38
  • 51
2
votes
2 answers

PHP output buffering (ob_start, ob_flush)

I used php output buffering earlier in order to create csv file from database, because i didn't want to create an existing file, just wanted to make content downloadable. CSV is text-based file, so its easy to create this way, you set the header and…
Iburidu
  • 450
  • 2
  • 5
  • 15
2
votes
4 answers

How to redirect with header location in php when using ob_start?

Hello " if ($condition) { header( "Location: http://www.google.com/" ); exit; } echo " World!

"; ob_end_flush(); ?> When $condition is true I get this: Hello What I want is when…
CRISHK Corporation
  • 2,948
  • 6
  • 37
  • 52
1
vote
3 answers

Is it possible to use php tags inside ob_start buffer?

I am trying to make complex template library. The thing is that I am holding my own syntax and php inside the same file as mixed. First my syntax is parsed and reformatted. Output is usual html + php as string. I don't want to make cache file but…
vellotis
  • 829
  • 1
  • 12
  • 26
1
vote
2 answers

ob_start() is printing outputs without ending of ob_get_flush()

Is there anything i am doing wrong in the following code. Ob_start should buffer the output right and it should not print it before you flush. But it is doing that
indianwebdevil
  • 4,879
  • 7
  • 37
  • 51
1
vote
1 answer

PHP ob_start called twice, won't flush correctly now

I have written a MVC-framework and I am using ob_start('error_handler') to be able to catch fatal errors aswell. This works great! In boot.php // Start the error-logging ob_start( 'error_logging' ); // Run the request Request::run(…
Tanax
  • 433
  • 2
  • 10
  • 20
1
vote
1 answer

How to properly flush PHP echo output

I am using PHPMailer to send emails with attachments. Each email takes about 5 seconds to send, and the PHP can send up to 5 emails with a total in that case of 10 PDFs... During all that time, the browser shows a white page. some…
Silloky
  • 147
  • 13
1
vote
0 answers

How to use require function with ob_*?

I have 3 files called Casino-review.php, functions.php, newfile.html. My problem is when i am creating a html file called newfile.html from functions.php and copying php output data from casino-review.php in the newfile.html. It's working properly…
1
vote
1 answer

How to start ob_start() in parent ob_start's callback

I have this code
Evgeny Naumov
  • 347
  • 1
  • 4
  • 15
1 2
3
12 13