0

I have a PHP file that scrapes pages and provides output. However, because scraping sometimes takes a little bit of time, the page takes a while to load. How could I print the contents of a page as it is loaded? For instance, load the first page and print, then load the second page and print, etc. I understand PHP prints everything out after all pages have been loaded. Would AJAX be the best route? If so, where would I start? I am unable to load the pages one by one in separate files, as the URLs are being pulled from one source.

Help would be appreciated!

This is not the same question - I tried the accepted answer and that didn't change a thing. Could it be because I'm using a foreach loop?

user3647894
  • 559
  • 1
  • 4
  • 28
  • Search `PHP output buffering` either on SO or on Google – Hanky Panky May 21 '15 at 16:20
  • Thanks for the response. I have fiddled with this a bit before posting on here but nothing seemed to change... – user3647894 May 21 '15 at 16:25
  • "How could I print the contents of a page as it is loaded?" Output buffering is the correct answer to this question. If you're having a specific problem with your code not working, you'll need to post the code before anyone can address it. Read [this help page](http://stackoverflow.com/help/mcve) for some guidance on what makes for a good example. – Patrick M May 21 '15 at 17:04

0 Answers0