I have a PHP script on my server that I want to run every time I post a new tweet to Twitter. Is there a way to automate this?
I could of course 开发者_运维技巧set up a cron job to run the script every five minutes, or run the script manually every time after tweeting, but neither of those is instant — and that’s exactly what I’m looking for.
Is it possible to use the Twitter API to run a script / get a URL every time my timeline is updated?
No, it is not possible.
The twitter API, as well as more or less every other web site API, do not allow you to set up such a feature. They only let you request data. It is up to you to request this data regularly and do something with it.
In theory, twitter could allow you to set up a command to be run when you do make a tweet, but bear in mind that it is free.
The only way I can think of you getting this sort of set us, is to use the twitter API to send an update to twitter, and then at the same time do what ever else you want to do. This will still let you get away with just tweeting from the one place, but you will have to always use that one other place.
Wouldn't it be better to just poll twitter for updates every few minutes?
Running a script every time you tweet is going to be a pain, and what if update it from a mobile device or something?
精彩评论