PHP tweetlater type script

popzzz

Supreme Member
Joined
Apr 12, 2009
Messages
1,314
Reaction score
13,986
.

Does anyone know of a PHP based script that is similar to tweetlater services to run on servers?

Would be killer if it used the browser object to avoid the twitter API limits.

Can anyone write one?

Thanx .....

If a post HELPS you don't be afraid to click the THANKS button .....

.​
 
well tweetlater pissed me off. I can't login to my account and they don't respond to my tickets. so I did a little search and found something, modified it and now it fill my needs :). Here it is - write your tweets as table entries and set up cron for this.

PHP:
<?php
// Set username and password
$username = 'username';
$password = 'password';
// The message you want to send

srand ((double) microtime() * 10000000); 
$input = array ("tweet1", "tweet2", "tweet3"); 

$num = array_rand($input); 
$message = $input[$num];

// $message = 'still writing new blog posts';
// The twitter API address
$url = 'http://twitter.com/statuses/update.xml';
// Alternative JSON version
// $url = 'http://twitter.com/statuses/update.json';
// Set up and execute the curl process
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
// check for success or failure
if (empty($buffer)) {
    echo 'message';
} else {
    echo 'success';
}
?>

here you go
 
.

Thanks adamlm! (and spla)

This is on the right track!

So is there anyway can get this to use the browser object so it doesn't hit the API and accompanying limits?

What if we converted it to PHP could we use the brrowser agent?

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.
 
Last edited:
Ok here is the guide posted by adamlm! (thanks again)
Ok, so here it's a quick guide. You need a hosting with PHP and cron to use is. It's quite different from tweetlater because it posts random tweets from the tweet table.

Step 1:
Put your twitter username and password into the following part of the script:

$username = 'username';

$password = 'password';

For each twitter account you'll need a separate file.

Step 2:
Enter your tweets into the following part of the script:

$input = array ("tweet1", "tweet2", "tweet3");

for instance it should look like this:

$input = array ("going to the gym", "reading BHW forum", "having kinky fun with my gf", "listening to MJ songs");

You can add a lot of these messages. I use about 500-700 for every account and I schedule them to post every 2-3 hours.

Step 3:
Save the file as twitter1.php (or anything you want) and upload the .php file to your web hosting account so you'll get http://yoursite.com/twitter1.php. Now put your browser to it. You should see a simple message - "success". Now take a look at you twitter timeline - a new random message is posted. And the best part - the footer of this message shows "from the web" instead of "tweetlater" or whatever.

Step 4:
Automate the process: set up a cron job on your hosting account to run http://yoursite.com/twitter1.php every 2 or 3 hours. You can do it through cPanel - read your hosting provider wiki/faq how to do it.

That's all. It's simple but effective. The hardest part is to get a list of messages. Here's how I did this in... MS Excel :)

1. write a list of 10-15 verb-like phrases such as "thinking of", "writing article related to", "browsing the net for" and put in the first column of an excel sheet.

2. get a list of noun-like keywords related to your niche from g00gle keyword tool and put it in second column, something like this: "weight loss", "acai berry diet" etc.

3. join these two colums using excel's funcion. you'll get results in the third column: "thinking of weight loss", "browsing the net for acai berry diet" etc. <- these are perfect tweets!

4. add results from third column to the script $input = array ( ...) You can try to use Notepad++ for this. Remember that your tweets must be in the following format: "message1", "message2".

I hope this is helpful.
 
popzz. I will tell you that just hope you arent on hostgator etc. Or somewhere where everyone is crammed on to servers like sardines. Because if others are interacting with twitter it also obviously adds to your API limit aswell.
 
popzz. I will tell you that just hope you arent on hostgator etc. Or somewhere where everyone is crammed on to servers like sardines. Because if others are interacting with twitter it also obviously adds to your API limit aswell.
Thanks!

My understanding (which may be wrong) of the API is that it is per account so if that is correct it should NOT matter as long as they are NOT using your account. The only counts towards the API are what actually passes through your OWN account.

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.
 

Thanks!

My understanding (which may be wrong) of the API is that it is per account so if that is correct it should NOT matter as long as they are NOT using your account. The only counts towards the API are what actually passes through your OWN account.

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.

No. There is a limit per account, but those are say friend additions per day, updates per day etc. The actual API limit is based on IP.
 
.

Hmmmmmmmm ..... just tried it and my tweets show "from API"
(OHHHhhhhh NOOOOoooooooooooooo)

Now what?

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.
 
No. There is a limit per account, but those are say friend additions per day, updates per day etc. The actual API limit is based on IP.

Quote from twitter Rate Limiting page:
Rate limiting

The Twitter API only allows clients to make a limited number of calls in a given hour. This policy affects the two APIs in different ways.

REST API Rate Limiting

The default rate limit for calls to the REST API is 150 requests per hour. The REST API does account- and IP-based rate limiting. Authenticated API calls are charged to the authenticating user's limit while unauthenticated API calls are deducted from the calling IP address' allotment.

Rate limiting only applies to methods that request information with the HTTP GET command. API methods that use HTTP POST to submit data to Twitter, such as statuses/update do not affect rate limits. Additionally, requests to account/rate_limit_status are not charged to a limit. These unlimited methods are still subject to daily update and follower limits to promote healthy use and discourage spam.
I don't have time right this second to really get into this but a brief scan looks like this would be "Authenticated API calls" as shown above that would apply to the users hourly limit of 150 would it not? (wonder why tweetdeck is 100 per hour?)

What you are referring to I believe is the "UNauthenticated API calls" for the entire ip address.

This was why I mentioned the browser object which would get around the limit altogether by using the post instead of get commands ..... (I think)

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.

 
Last edited:
Hmmmmmmmm ..... I don't know about the random feature .....

If we take the array_rand OUT and just make it array will that remove the random factor where it will simply post each tweet in order?

What happens when it reaches the end ..... does it start over or what?

Anyone know? I just don't have time to tinker just now .....

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.
 


Quote from twitter Rate Limiting page:I don't have time right this second to really get into this but a brief scan looks like this would be "Authenticated API calls" as shown above that would apply to the users hourly limit of 150 would it not? (wonder why tweetdeck is 100 per hour?)

What you are referring to I believe is the "UNauthenticated API calls" for the entire ip address.

This was why I mentioned the browser object which would get around the limit altogether by using the post instead of get commands ..... (I think)

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.


Woops. Correct you are. Sorry :). I get confused as to how they count it. To be honest they will just block you in any case. If you look at my friend adder. Add a 500 friends and check API limits. Nothing has changed. Twitter hasnt counted anything. They will just "limit" you when they want to.
 
Hmmmmmmmm ..... I don't know about the random feature .....
If we take the array_rand OUT and just make it array will that remove the random factor where it will simply post each tweet in order?
What happens when it reaches the end ..... does it start over or what?​
The above does NOT work as I described.

This script as-is will NOT work for me anyway ..... I need to post one tweet then post next tweet, etc, etc sequentially in order (1,2,3,4,5) right down the line one after the other straight through to the end then start the list over again .....

This posts the tweets randomly and even beyond that it repeated a tweet in the first THREE posts! YIKES!

Gonna see if I can modify it but in the meantime does anyone know how or have a clue?

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.
 
Last edited:
Quote from twitter Rate Limiting page:I don't have time right this second to really get into this but a brief scan looks like this would be "Authenticated API calls" as shown above that would apply to the users hourly limit of 150 would it not? (wonder why tweetdeck is 100 per hour?)
UPDATE: Yesterday twitter increased the hourly limit to 150! YES!

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.​
 
..... Add a 500 friends and check API limits.
How do you check your API limits anyway?

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.​
 
.

WOW!

Of all the scripts online I cannot find one that is NOT random! Looks like it would at least be an option or something!

Anyone?

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.
 
Through another API call.
How do you get it to return the count and/or limit?

HTH

If a post HELPS you don't be afraid to click the THANKS button .....

.



 
Back
Top