Fair warning - there may be a more secure way to do this, but I'm not overly concerned about the terribly minuscule chance of someone figuring out how to post a fake tweet to my account. YMMV.
Your server will need to have PHP and Curl installed at the very least.
I used the instructions here
Search results - WebOS Internals
to add a few new items to global search, including Amazon, Twitter search, Gmail, and posting directly to twitter using the PHP API. What I did was create a php script on my web server that looks like this:
Code:
<?php
$uname = 'YOUR TWITTER USERNAME';//example "blah" for twitter.com/blah, or your email address
$pwd = 'YOUR PASSWORD HERE';
$twitter_url = 'http://twitter.com/statuses/update.xml';
$curl_handle = curl_init();
curl_setopt($curl_handle,CURLOPT_URL,"$twitter_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=" . $_GET['status']);
curl_setopt($curl_handle,CURLOPT_USERPWD,"$uname:$pwd");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
if (empty($buffer)){echo '<br/>message';}else{echo '<br/>success';}
?>
Save the file on your server as something like post-to-twitter.php, then follow the instructions at
Search results - WebOS Internals
to add the necessary new global search option and graphic. For the url that would normally be a search string, use
Code:
http://www.yourserver.com/post-to-twitter.php?status=
Now, from anywhere you can get to global search, just start typing your tweet. Choose your new search option when you're done typing it out and voila!
Thoughts?