Hello,

I'm looking for a script that sends out a short Email every day - along the lines of those joke a day Emails. I'd like to enter my information all at once (say, for 30 days) and have the script automatically send out the Email to subscribers on a daily basis for the correct day.

I'm not sure what to look for over at hotscripts. If you have recommendations, I'd greatly appreciate them.

Thanks in advance!

    PHP is not the sort of script that runs automatically on the server at timed intervals. You will have to write your own perl scripts for that. However, something you COULD do is create a database table to hold your jokes, and assign a date to each one. In your page you include jokeaday.php, and within that file, look up to your table to pull the current day's joke. You could also use that same table to pull ANY day's joke, for archiving purposes.

      Hate to say it but that's not true. 🙁 I have many PHP programs running using Cron. PHP can be used as a shell language (and it's VERY awesome). Here's a link in the PHP documentation to help:

      http://www.php.net/manual/en/features.commandline.php

      And actually, after taking a quick glance through that it's quite in depth. Here's the quick summary. The way I have done it is by compiling my own PHP cgi, then doing this:

      #!/usr/home/ffmllc/php/php -q
      <?php
      

      That is how you start your file, obviously the path is the path to the compiled cgi. CHMOD the file accordingly (755 works) and you're good to go. Type ./yourfilename.php and it should run. Take off the "-q" from the path to make it verbose.

      When you run this script from cron, use the full path from root.

      Hope this helps,
      Tom

        PHP is interesting in that is can act as a compiled binary command line interpreter, or just as a script language within webserver documents.

        Generally speaking, 'cron' and the compiled binary would be the thing here (yes, or perl, or sh, or python, or....??), but I saw recently a post where a guy just had a system where the first page load of his home page on a given day would execute some kind of mailout script he'd written.

        I guess to put it together, you could even have cron lynx or telnet 80 the page every day at 4 a.m. or something and have it work. My bet is, though, that you'd have to write it yourself !!

        I do have a 'bible verse of the day' on a church site I did...quite simple, and nice, too. Reads from a 31 line text file....

        ----dalecosp

          3 years later
          BuzzLY wrote:

          PHP is not the sort of script that runs automatically on the server at timed intervals. You will have to write your own perl scripts for that. However, something you COULD do is create a database table to hold your jokes, and assign a date to each one. In your page you include jokeaday.php, and within that file, look up to your table to pull the current day's joke. You could also use that same table to pull ANY day's joke, for archiving purposes.

          i am searching for something like this, to use to include content based on day of the year, i have no coding experience at all, makes matters worse? can u please expand on your method if i can understand it. especially the content of jokeaday.php which i suppose will include a code to get the current day....
          thank

            As mentioned in this thread four years ago, it's possible to run PHP programs at regular intervals through the use of cron. Try searching the forums for that word.

              While you can run PHP scripts via cron, PHP really wasnt designed with that in mind. It was intended to be a server-side web scripting language.

              You are better off writing the script in PERL or C/C++ if you're knowledgeable enough. I think you might even be able to find a script to suit your needs on hotscripts or at http://cgi.resourceindex.com

              If not you may be able to call a PHP script from within a heavily trafficked page that checks to see if the joke has been sent for that day already. Personally cron is a better option though.

              🙂

                Weedpacket wrote:

                As mentioned in this thread four years ago

                Gee, almost like a slap in the head, isn't it.

                When in the world did I post in a thread called that ??? 😕

                While you can run PHP scripts via cron, PHP really wasnt designed with that in mind. It was intended to be a server-side web scripting language.

                But when PHP took the 'Bazaar' by storm, it became all that and more. Nothing wrong with PHP via cron, PHP via CLI (my $PATH includes ~/bin, which is just chock full o'little script and toys, more than half of which are in PHP); in fact, it seems a good economy for those who can't "C" (pun intended) the point of learning (or have the time to learn) Yet Another Language....

                  Write a Reply...