SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Location
    Lincolnton
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Batch Processing

    Hi programmers, I have written a few simple scripts to manage my newsletter subscribers. However, my "mailing" script doesn't seem to be able to handle more than 100 or so email addresses before timing out or locking up (when run from my browser). Eventually I would like to CRON this file to automatically send my newsletters, will that fix the problem.

    Otherwise, I was wondering if anyone had some batch processing code. Eg. it sends to emails 1-100, pauses, then sends to 101-200, etc. until it sends to all of them.

    Thanks for your time,
    Andy

  2. #2
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The easiest way to do this is to auto-refresh the HTML page calling the script. For example:

    script.php?startat=1

    Going to the above URL will e-mail out 100 messages starting at position 1 on the e-mail list. It will also generate a <meta> tag which will redirect the browser to the following page in 20 seconds:

    script.php?startat=101

    That URL will mail out 100 emails starting at number 101, and redirect your browser to script.php?startat=201 in 20 seconds time. Keep doing this until all the e-mails have been sent

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Location
    Lincolnton
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will that work even if the file
    script.php?startat=1
    is cronned? Will the meta refresh still work?

  4. #4
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All the CRON does is tell the script to run. So it would not affect the outout at all.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  5. #5
    What's HTML?
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    1,701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Skunk
    [B]The easiest way to do this is to auto-refresh the HTML page calling the script.
    It may be the easiest way, but is it the best way? I need to make a similar script next week and I'm wondering about the timing-out. If I did it your way, wouldn't I need to let the browser keep doing it's loop?

    There must be some way to make the script send out all the email without relying on the browser. Any ideas?
    Ryan Kuhle - A Proud Advisor - Got Questions? Just Ask!
    Get your website started for less than $20! Click Here

  6. #6
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use sleep() ?
    i dunno...

  7. #7
    SitePoint Member
    Join Date
    Jun 2001
    Location
    CA
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use sleep() ?
    Nope, as far as the server is concerned, a sleep()ing script is still running, so the maximum runtime is still ticking away. (Unless somechanged somthing and didn't tell me)
    Ripped_Edge
    ripped_edge@hotmail.com
    http://www.452productions.com
    World Domination on a Global Scale (TM)


Bookmarks

Posting Permissions

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