Check out the docs [1]. There is half a line change to switch from
authorizing to updating.

[1]
https://docs.google.com/View?docID=dcf2dzzs_2339fzbfsf4#Process_4555055271827706_12118

On Tue, Apr 21, 2009 at 16:54, Doug D <[email protected]> wrote:

>
> Thanks Chad!
>
> I've checked out Abraham's OAuth lib, but I don't see how to update a
> twitter status. His example seems to only authenticate and return data
> on the person who's authenticated.
>
> doug
>
>
> On Apr 21, 5:00 pm, Chad Etzel <[email protected]> wrote:
> > Take a look at Abraham Williams' excellent Twitter PHP Oauth lib:
> >
> > http://twitter.abrah.am/
> >
> > -Chad
> >
> > On Tue, Apr 21, 2009 at 4:36 PM, Doug D <[email protected]> wrote:
> >
> > > I've been digging in to the Twitter OAuth stuff and am able to sign
> > > into my site with the Twitter authentication, but I'm wondering if
> > > there is a way to use the OAuth credentails to send a status update
> > > using PHP and cURL. The code below sends an update, but only when a
> > > static username:password is filled in.
> >
> > > My goal it to update (your) Twitter status from my site once you are
> > > authenticated by Twitter. Any thoughts or tutorials? Thanks!
> >
> > > // Set username and password
> > > $username = 'name';
> > > $password = 'password';
> >
> > > // The message you want to send
> > > $message = 'My status update';
> >
> > > // 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';
> > > }
> >
> >
>



-- 
Abraham Williams | http://the.hackerconundrum.com
Hacker | http://abrah.am | http://twitter.com/abraham
Web608 | Community Evangelist | http://web608.org
This email is: [ ] blogable [x] ask first [ ] private.
Sent from Madison, Wisconsin, United States

Reply via email to