Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Thanked 0 Times in 0 Posts

    Blank page returned for large script

    I'm scraping content from a page and its sub pages and placing it into an XML file. I use PHP Simple HTML DOM Parser (http://simplehtmldom.sourceforge.net/) to do this, and it works very well.

    The problem I'm having is that sometimes it works fine (after taking around 20-30 seconds), but other times it just returns a blank screen. So its clear that the script works, but sometimes it seems to just time out. I have tried removing the memory limit to stop the page timing out:

    PHP Code:
    But sometimes I still get the blank screen and nothing added to the XML file. Any idea on how I can stop this form happening?

  2. #2
    Senior Coder
    Join Date
    Sep 2010
    Thanked 275 Times in 275 Posts
    The timeout and memory limit will be separate issues.
    Upload a page with this on it, and access it.
    PHP Code:
    It will tell you about time and memory limitations. To get around the time limitation separate the task into two parts with different scripts.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.

    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  3. #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,668 Times in 2,637 Posts
    Even better, check your error logs. White pages indicate either no print or an error condition without enabled reporting. The error logs will still have these, so if you check them out than it should tell you a cause.
    Assuming web based run, the default configuration for the time limit is 30 seconds. Once it hits that, it will issue a fatal error. Memory limit won't stop the timeout, it will control the maximum amount of memory available for PHP. Only adjust this if you require more memory. The defaults are: < 5.2.0 8MB, 5.2.0 16MB and > 5.2.0 128MB. 8MB is sufficient for most operations including DOM with a page scrape. If you have 8MB+ XML file, than you'd need to adjust. The 128MB is a tremendous amount.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts