ScheduledTweets: Free And Fully Ajaxed PHP Application To Schedule Tweets

Almost every Twitter user needs the ability of scheduling tweets. There may be a tweet that you need to send later or you may want to Tweet 7/24 but you must sleep as well :).

Although there are web based services which enable you to schedule tweeting, you may not want to give your Twitter password.

Here comes ScheduledTweets. It is a 100% free web application to schedule your tweets that you can install into your web hosting account.


ScheduledTweets is built with PHP, uses MySQL to store the data & its interface is fully Ajaxed.

It enables you to define time-intervals which your tweets will be sent every x minutes. You can enter unlimited tweets, drag'n drop your tweets to change the order they will be sent.

Also, URL shortening service TinyURL is integrated for shorter tweets.

ScheduledTweets comes with a web-based friendly installer that helps you define database & Twitter information easily.

Why To Use ScheduledTweets?

Twitter is both an instant messaging & a micro-blogging platform. You will probably not schedule your personal tweets (I won't, as it clearly becomes meaningless) but if you are regularly sharing stuff on a subject (like I do), then it has the same benefit as scheduling a post on a blog.

How To Use?

Once you are logged in,

  • Add tweets to the queue (you can drag'n drop order them)
  • Add schedules like: on Mondays, between 10:00 to 16:00 tweet every 60 minutes .Schedules are not that smart -currently- & you can define crossing schedules.

How To Install (Automated)?

  • Create a MySQL database & user
  • After downloading it, unzip the files to a folder & upload them to your hosting account
  • Run
  • Define the MySQL database information you created in the first step. Also define your Twitter info and desired ScheduledTweets admin info
  • Click install
  • Setup a cron job to (the interval must be lower than your smallest interval defined in ScheduledTweets)
  • Click "Start ScheduledTweets" button at the top menu
  • That's it

How To Install (Manual)?

  • Create a MySQL database & user
  • After downloading it, unzip the files to a folder & upload them to your hosting account
  • Run setup.sql (inc/setup/setup.sql) on your database
  • Edit the options in inc/config.php (database info, Twitter info, scheduledTweets info)
  • Setup a cron job to (the interval must be lower than your smallest interval defined in ScheduledTweets)
  • Click "Start ScheduledTweets" button at the top menu
  • That's it

How To Setup Cron Jobs:

If your hosting provider does not enable you to setup cron jobs than you can use these free web services as well:



  • Multiple Twitter accounts support
  • Multiple URL shortening services support
  • Displaying tweets sent previously
  • Disable crossing schedules


ScheduledTweets is free to use for both personal & commercial projects. But it can not be sold or re-distributed in anyway.

Thanks to:

P.S. I'm more a Microsoft scripting languages guy (sorry :)), wanted to dive into PHP & this project is the longest code I've written with PHP. So, I'll be glad to hear any improvements.

Update (20 April 2009):


  • inc>functions.php is updated to fix the non-functioning start-stop button.
  1. Reply Phil April 7, 2009 at 1:33 AM

    Umut, that looks awesome. Can’t believe that you give this for free.

    I will try this today 🙂

    Keep up the great work. Love WRD.

  2. Reply Adrian April 7, 2009 at 3:11 AM

    Thank you for sharing this tutorial to us.

    i will try today.

    thank you again.

  3. Reply jangkrikjr April 7, 2009 at 7:31 AM

    Wow…it’s really usefull. Thanks to share with us 🙂

  4. Reply HMERT April 7, 2009 at 3:05 PM

    Umut, very good job. Thanks for giving away it. I will try to make some improvements 😉

  5. Reply Umut M. April 7, 2009 at 3:14 PM

    @Phil, @Adrian, @jangkrikjr,

    Great to hear that it looks good on your side. I had fun while creating it.


    Thanks very much for the support 🙂 .

  6. Reply Jamal April 8, 2009 at 1:09 AM


    Great work, only yesterday I was searching for similar tweeting function, happy to have it delivered for free today :-).

    I am trying to import my feeds and schedule them, and add some function like edit tweet in q.


  7. Reply Miles April 19, 2009 at 3:55 PM

    Can’t get it to work once installed 🙁

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘milest_milest’@’localhost’ (using password: YES) in /home/milest/public_html/ on line 12
    Error connecting to mysql

  8. Reply Umut M. April 20, 2009 at 3:49 AM

    For some reason it can not connect to your MySQL server.

    Can you check the inc/config.php and make sure all your connection, ScheduledTweets and Twitter setting are written there. If not, then please manually mention them as there maight have been a write error in the installation.

  9. Reply Misty April 22, 2009 at 6:14 AM

    Nice! Thanks – this is perfect!!!!

  10. Reply TheAnand April 22, 2009 at 9:18 AM

    a bug, you cannot add tweets with an apostrophy 🙂

  11. Reply TheAnand April 22, 2009 at 9:19 AM

    I am not able to get the cron job working…otherwise, this is awesome.

  12. Reply Umut M. April 22, 2009 at 10:08 AM


    Make sure system is started. Check the top menu of the application. There is a start-stop button there.

    And, you can use to setup a cron job.

  13. Reply David April 22, 2009 at 12:57 PM

    Nice. I just installed it. FYI… if the tweet has an ampersand it truncates before it.

  14. Reply Umut M. April 22, 2009 at 1:11 PM

    @TheAnand & @David,

    There is an input filter/protection that clears some types of inputs. I’ll be fixing the ampersand problem & upload the new version in a few days.

  15. Reply Steve Krzysiak April 22, 2009 at 3:40 PM

    This works great and thanks for developing and making this public. I noticed that today it was not posting my tweets and started to step through the code, at which point I found the if clause that was holding it up. On line ~256(give or take, I added some debug statements) in functions.php, there is this condition:

    if (date(“H:i:s”, mktime()-($scheduleInterval*60)) >= $lastTweetTime)

    which basically was returning false the whole time during my interval(9-17) because the time of my last tweet was 15:39(lastTweetTime), yet all the times being returned via date() were before that time.

    When I deleted that tweet from the DB(it was the only tweet there), everything worked fine. I am doing 9-17:00 intervals, so I imagine I will have this problem again tomorrow morning.

    unless there is something that I am blatantly overlooking, which is very probable!

    Feel free to email me to talk about this.

  16. Reply Steve Krzysiak April 23, 2009 at 2:27 PM

    So I fixed my issue adding a second condition to that if statement as follows:
    if ((date(“H:i:s”, mktime()-($scheduleInterval*60)) >= $lastTweetTime)||($tweetSentDate < date(“Y:m:d”)))

    where $tweetSentDate is:
    $tweetSentDate = $row[‘tweetSentDate’];

  17. Reply Steve Krzysiak April 29, 2009 at 4:26 PM

    Uggh, one more update. It occurred to me today that the original mysql query that grabbed the row which directly affects the if statements in my previous comments(see above) did not work properly with mySQL. Instead, the tatement I had to use was this:
    SELECT * FROM tweets WHERE tweetStatus = 1 ORDER BY tweetSentDate DESC, tweetSentTime DESC LIMIT 1

    the difference being “…tweetSentDate DESC, tweetSentTime DESC” instead of “…tweetSentDate, tweetSentTime DESC”

  18. Reply Umut M. April 30, 2009 at 12:40 AM


    Thanks very much for the updates.

    I couldn’t find a time to dive into the code but will be checking the problems you mentioned and adding the fixes today.

  19. Reply Andrew April 30, 2009 at 6:27 AM

    I installed the script,,, fine,
    ran a cron,
    … doesn’t work.

    Is there an update?

  20. Reply Maggie May 9, 2009 at 7:42 AM

    Thanks Umut M. for your work! I don’t understand the update scheme. It’s either me or a bug …

    The cron triggers your script every 57th minute of every hour.

    scheduleStartTime 01:55
    scheduleEndTime 18:05

    With the scheduleInterval at 165, I get only 2 tweets per day, at:

    That’s it. Same setting, but a higher interval results in *more* tweets:

    scheduleInterval at 330.


    Is this related to Steve Krzysiak suggestions, or something else?

    Thanks anyway!

  21. Reply Jim May 14, 2009 at 1:26 PM

    Does this allow oathetication through twitter for other users to be able to schedule their tweets? Or is this pure database/configuration file for one account only.

  22. Reply Umut M. May 14, 2009 at 5:28 PM


    It is only for 1 user. On th other hand with some modification, it can easily be converted to a multi-Twitter-user application.

  23. Reply Maya Janis May 16, 2009 at 7:22 AM

    @steve Thanks for your update. Suddenly the software seems to work again. Thanks for the code x 2.

  24. Reply Steve Krzysiak May 18, 2009 at 6:30 PM

    @Maya Glad my code helped someone, for awhile I thought I was rambling!

  25. Reply George May 19, 2009 at 6:43 AM

    Crons won’t work can somebody point to a bug free update or some guidance?

  26. Reply George May 20, 2009 at 9:02 AM

    @Steve Krzysiak can you post an up to date file that gets this cute little script working?

  27. Reply Umut M. May 20, 2009 at 9:52 AM

    Just FYI, I have updated the script but just couldn’t polish it. I’ll certainly be uploading the “fixed” version this week & anybody can download.

  28. Reply George May 20, 2009 at 11:24 AM

    Thanks for the heads up Umut.I’m head over heels for the updated version, thanks.

  29. Reply pico May 24, 2009 at 8:25 AM

    tierd this it won’t work any other alternative?

  30. Reply Spence Rose May 25, 2009 at 10:00 AM

    So I subscribed to the rss feed, and I did not see how to download the application. How do I do this?

  31. Reply Umut M. May 25, 2009 at 2:13 PM


    While reading the latest post from a RSS reader, you can see the link at the bottom of the post under the title: “special downloads”.

  32. Reply James West May 28, 2009 at 3:46 AM

    Very nice script! I have made a few modifications to the script and all is running very well.

    One thing you will need to add, though, is: $status = urlencode($status); in your sendTweet function as you have to URL encode any data sent to twitter via the API.


  33. Reply Andrew May 30, 2009 at 7:30 PM

    Mine just doesn’t work, please help!

  34. Reply Mike Jones May 31, 2009 at 5:11 PM

    is scheduledTweets open source so that we can update it to fit application within our own site.

  35. Reply Bubba42 June 24, 2009 at 8:41 AM

    The application has stopped working after only a day. I’ve even waited a day and hit the cron link myself, but it won’t work. Is there any further development on this?

  36. Reply Umut M. June 26, 2009 at 4:48 AM

    Yes, it is open source & you can use it almost however you want. Just, can not re-sell or distribute it.

    There is still development. I have fixed some bugs but just couldn’t polish it. I’m willing to make it online for a while but just couldn’t create the time. Will try to do it this week.

  37. Reply Jay July 16, 2009 at 7:15 PM

    any news on the updated fixes?

  38. Reply Umut M. July 17, 2009 at 12:53 AM


    This was probably my worst planning on a project.

    I have the app working here but couldn’t update few thing & share.

    Ok, promise, I’ll be rolling the update next week no matter what :).

  39. Reply Andrew July 20, 2009 at 11:21 AM

    Any updates? Mine still will not work.

  40. Reply Umut M. July 20, 2009 at 1:17 PM


    Like mentioned above, I’ll be rolling an update this week. Around Wednesday or Thursday I think.

  41. Reply rai come July 29, 2009 at 11:47 AM

    I cant get it to work probably. i works when , logged in and reload within the timeframe i made. (16.00 – 16.25 every 20 minutes) just want it to do one tweed every day.

    The cron job is from ( since my webhost aint supporting cron job.

    Is there a way to test if the cron job is actually working, correct?

    many thank for the code

  42. Reply Broken October 12, 2009 at 11:14 AM

    This is a total shame, set cron job and the script just sits idle, I get thrown out of Twitter but no Tweets to show for, just too many connection that were supposedly made.
    Why not give a step by step clear explanation of how to set it up correctly?
    Thanks for nothing!

  43. Reply Umut M. October 12, 2009 at 4:31 PM


    It may have some problems, bugs for sure.

    However, there is a step-by-step tutorial, don’t know what else to mention in the steps as there are no less & more steps.

    And, you may have realized already that it is not a commercial script, it is free and open source. So that other users, like you, can improve/fix what I have done missing/wrong and share a better code.

  44. Reply Dave October 20, 2009 at 3:13 PM

    Hi Umut,

    Don’t know if you were aware, but there’s another Cron service ( that also can help out here, too. If you’re tweeting once a day (or even twice), the jobs are FREE for life, unlike the other two services. 🙂


  45. Reply Alister Cameron // Blogologist November 1, 2009 at 4:31 AM

    Hi Umut.

    Anyone you know of who has added…

    Also, your roadmap is looking a little like you’re never going to get there… since this app has been around since April.

    I’d love to see support, and am sure I could sort it out myself, but just wondering. Lazy as I am!

    Alister (@alicam)

  46. Reply Umut M. November 1, 2009 at 7:00 AM

    You’re right with that. I have some updates on my side but just couldn’t create the time for cleaning the code and uploading them.

    For, although I don’t know if anyone is implemented that, you can Google a php function and replace that on the code.

  47. Reply Zach Schneider November 6, 2009 at 9:54 PM

    Thank you @SteveKrzysiak for the updated functions.php
    I posted for download on my server everyone is welcomed to it:

  48. Reply Soso Jana December 24, 2009 at 11:24 PM

    hey body… how to download it.
    After subscribe what to do … i didn’t see any link or something in email or google reader

  49. Reply Umut M. December 25, 2009 at 12:56 AM


    In your RSS reader, check the latest WRD post:
    You’ll find “special downloads” at the bottom of the post.

  50. Reply Bright-Tutorials January 5, 2010 at 6:19 PM

    Very useful information. Thanks I will be taking this apart and making it into a cron. The source code will be available at if anyone wants it.


  51. Reply Danny January 17, 2010 at 10:02 AM

    Thanks for this. One question – what should the ‘command’ be for the cron job?

  52. Reply Umut M. January 17, 2010 at 2:38 PM
  53. Reply David February 15, 2010 at 11:20 AM

    Thanks Umut! I was preparing to write a similar script but decided to see what might be available first. Much appreciated.

    Thanks also to Steve for bug-fix suggestions.

    I modified functions.php in a couple of ways that others might find helpful (and probably won’t stop there)…


    1: My error_log was filling up faster than I could keep track of it because of the lack of parameters usualy being sent and the interval of the cron job. I added this function and changed the variable assignment accordingly. Note that I commented out the use of the myfilter class, figuring that if I’m the only one adding the tweets that I could know to be careful about using tags and such.

    function setVar ($varName) {

    if (!empty($_POST[$varName])) {
    $checkValue = $_POST[$varName];
    } else {
    if (!empty($_GET[$varName])) $checkValue = $_GET[$varName];
    else $checkValue = ”;

    return $checkValue;


    $installDBName = setVar(‘installDBName’);
    $installDBUser = setVar(‘installDBUser’);
    $installDBPass = setVar(‘installDBPass’);
    $installDBHost = setVar(‘installDBHost’);
    etc., etc. [make sure to catch them all–there’s one GET and the rest are POST]


    2) I also quoted the ‘w’ in this section of code (in 3 places) to eliminate those error_log entries:

    if (date(‘w’) == 0) {
    $dayToUse = date(‘w’) + 1;
    } else {
    $dayToUse = date(‘w’);


    3) In the >> if ($action == “newTweet”){ <> $query = “INSERT INTO tweets… <<, I added:

    $tweetDetails = str_replace(chr(10),'',$tweetDetails);
    $tweetDetails = str_replace(chr(13),'',$tweetDetails);
    $tweetDetails = mysql_real_escape_string($tweetDetails);

    This removes carriage returns and newlines that might inadvertently get put into the tweet, and also properly escapes various characters appropriate for insertion in mySQL such as quotation marks, apostrophes and backslashes (see


    4) A minor change but worth considering:

    The text "Error, insert query failed" appears in six places in the code and "Error, update query failed" appears in three. I numbered them so I'd be able to tell where a problem was occuring (i.e. failed #1..#6,failed #1..#3).


    Hope this proves to be helpful for others.


  54. Reply David February 15, 2010 at 11:25 AM

    How ironic. I said I could be careful about using tags, and then in my post I used symbols that didn’t translate well :-).

    Number 3 should read…

    3) In the section [-= if ($action == “newTweet”){ =-] just before [-= $query = “INSERT INTO tweets… =-] I added:


  55. Reply David February 15, 2010 at 12:11 PM

    A few other things of note:

    1) As James West points out, add “$status = urlencode($status);” near the beginning of the if statements (such as under the “$tweetUrl = …” statement.

    2) The script does exactly what it’s supposed to. Unless you are encountering a technical issue (i.e. connection issue with mySQL database), you may be expecting something different of it. For example, tweets go out at the interval scheduled, during the days and times entered (don’t miss this step), and when Scheduled Tweets is “started” but not when it is “stopped”. Each tweet you enter will only ever get tweeted once (tweetStatus flag), so if you enter three tweets and have an interval of 5 minutes–and you don’t enter more tweets–cron will continue running the job but you won’t see anything new after about 15 minutes. As written, it doesn’t loop and the same tweets aren’t then tweeted the next day.

    3) FYI, I’m not the David or Dave who posted _prior_ to today.



  56. Reply Umut M. February 15, 2010 at 12:18 PM


    What you’re doing is great.

    Scheduled Tweets is 95% complete but had that 5% problems which was causing problems. I did some updates locally but couldn’t find time complete & organize them.

    It’ll be great that you post any updates you make, I’ll be watching them and once you’re ok, I’ll update the download.

    Again, thanks so much, this is why I love open source :).

  57. Reply David February 28, 2010 at 12:50 AM


    Many thanks. I know the feeling all too well of not getting the last 5% done :-)!

    I had thought about this before but didn’t give it much attention. The $dayToUse = date(‘w’) + 1 (when == 0 ) isn’t right. You’re using 1-7 for Monday through Sunday, so that would theoretically duplicate Monday’s schedule twice.

    Although, and I’m far too tired right now to delve into it, that’s not what happened. Instead, I noticed that after midnight on Saturday (thus, on Sunday) tweets began sending at the cron-job interval (in my case, 5 minutes) rather than at any interval listed in the ‘schedules’ table (all greater than 10 minutes).

    I’ve changed:

    if (date(‘w’) == 0) {
    $dayToUse = date(‘w’) + 1;
    } else {
    $dayToUse = date(‘w’);


    if (date(‘w’) == 0) {
    $dayToUse= ‘7’;
    } else {
    $dayToUse = date(‘w’);


    And now I’m going to get some much-needed sleep. 😉



  58. Reply David February 28, 2010 at 12:53 AM


    Incidentally, you mention that there were some known problems. Are you aware of anything else that hasn’t been touched on in these comments?

    Definitely three cheers for open source!


  59. Reply rathin April 12, 2010 at 5:48 AM

    Great DEMO.. really It appreciate me …

  60. Reply Karl September 25, 2010 at 9:54 AM


    i like this software, but twitter has changed now to oauth only. Will you change the software also?


  61. Reply Umut M. September 28, 2010 at 7:48 AM


    I’d love to update it but can’t find the time for that right now.

    If any users update it, please let me know and I’ll be happy to update the files with the new ones.

  62. Reply Giles October 31, 2010 at 3:28 PM

    Wouldn’t it be nice if I was able to update this script to use oAuth? That would be the second of your free downloads that I provided a key upgrade to. Interesting… Need to find time to do this.

  63. Reply Umut M. November 2, 2010 at 2:06 AM


    That would be awesome again 🙂

  64. Reply mark February 8, 2011 at 1:27 PM

    If anyone has updated this to use Oauth and is willing to share please let me know.

  65. Reply John Martin July 1, 2011 at 12:16 AM

    tried everything and it al seems to work except for one thing…. i don’t see any new tweets appearing my twitter page. I even setup the cron jobs and everything…. and i set cron jobs all the time so it’s not that.

  66. Reply Umut M. July 5, 2011 at 5:03 AM


    Twitter removed the standard authentication method it provides and now only supports oAuth which ScheduledTweets currently doesn’t support.

  67. Reply Mahmood April 15, 2012 at 2:11 PM

    I can’t believe i spend my weekend on this thing trying to make it work, it look great and handy. thanks to the creator.

    did anyone figured out how it will work with the new twitter authintication?

  68. Reply Mahmood April 17, 2012 at 6:35 AM

    Hi there,
    I changed the script to include the new (oAuth), I’m able to post to twitter now but only the first msg in line, it doesn’t move to the next msg somehow.

    I will try to fix this if i could, if anyone have any advice please contact me. I will share the package once its fully functioning.

    thanks again to the creator 😉

  69. Reply Mahmood April 23, 2012 at 3:00 PM

    @Umut, thanks for ignoring me here and on twitter, got everything sort out, its a great script so i have to say thanks again for sharing it.

  70. Reply Umut M. April 23, 2012 at 3:25 PM


    I haven’t seen the twitter message, sorry for that.

    After not touching the ScheduledTweets code for the last year, I was expecting that the community could answer your questions (which you seem to have asked to them as well).

    Anyways, great to hear that everything is sorted out.

  71. Reply N May 23, 2012 at 9:57 AM

    Nice script, it doesn’t work out of the box but if you understand PHP a little it’s not difficult to get it working again.
    To make it work I used this one, but there are other scripts/classes as well.

  72. Reply Dave July 2, 2012 at 10:41 AM

    Does anyone have an up-to-date version of this script that works and is compatible with the new twitter OAuth lib? I can shoot you some cash for it – it’s required for a project.


  73. Reply DTEK October 1, 2012 at 7:09 AM

    Really nice web app , it can easily compete bufferapp with some extra modifications and addons our team has started development on it .. 🙂

  74. Reply Sam Tuke October 18, 2012 at 6:37 AM

    Any chance of changing the license so I can work on it?

    Please please please switch to AGPL or similar so this app is useful again!

Leave a reply