You do not need to change anything in OAuth.php or twitteroauth.php.

Abraham
-------------
Abraham Williams | Hacker Advocate | abrah.am
@abraham <https://twitter.com/abraham> | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.



On Mon, Feb 7, 2011 at 08:33, Mike Jones <[email protected]> wrote:

> I just need to edit the 3 lines of code rather than anything in the
> OAuth.php or twitteroauth.php files correct? Or do I need to change
> stuff in those two files?
>
> On Jan 27, 3:06 pm, Abraham Williams <[email protected]> wrote:
> > Using TwitterOAuth you basically need three lines of code to get started.
> >
> > https://gist.github.com/564882
> >
> > Abraham
> > -------------
> > Abraham Williams | Hacker Advocate | abrah.am
> > @abraham <https://twitter.com/abraham> | github.com/abraham |
> blog.abrah.am
> > This email is: [ ] shareable [x] ask first [ ] private.
> >
> > On Thu, Jan 27, 2011 at 13:49, Peter Denton <[email protected]>
> wrote:
> > > Abraham's oAuth library and examples work pretty much out of the box.
> > >https://github.com/abraham/twitteroauth
> >
> > > If you need any help, please feel free to ask me off the list.
> >
> > > regards
> > > Peter
> >
> > > On Thu, Jan 27, 2011 at 12:59 PM, Mike Jones <[email protected]
> >wrote:
> >
> > >> I was using the following code to hook to my twitter account but now
> > >> since I was using basic authentication instead of OAuth I am not
> > >> tweeting anymore. Does anyone know of the code of samples that use
> > >> OAuth with cURL/PHP?
> >
> > >> <?
> >
> > >> function make_jmp_url($url,$login,$appkey,$format = 'xml',$version =
> > >> '2.0.1') {
> > >>        //create the URL
> > >>        $jmp = 'http://api.j.mp/shorten?version='.
> > >> $version.'&longUrl='.urlencode($url).'&login='.$login.'&apiKey='.
> > >> $appkey.'&format='.$format;
> >
> > >>        //get the url
> > >>        $response = file_get_contents($jmp);
> >
> > >>        //parse depending on desired format
> > >>        if(strtolower($format) == 'json')
> > >>        {
> > >>                $json = @json_decode($response,true);
> > >>                return $json['results'][$url]['shortUrl'];
> > >>        }
> > >>        else //xml
> > >>        {
> > >>                $xml = simplexml_load_string($response);
> > >>                return 'http://j.mp/'.$xml-<http://j.mp/%27.$xml->
> > >> >results->nodeKeyVal->hash;
> > >>        }
> > >> }
> >
> > >> function tweet($status) {
> >
> > >>        $username = 'test';
> > >>        $password = 'test';
> >
> > >>        if ($status) {
> > >>        $tweetUrl = 'http://www.twitter.com/statuses/update.xml';
> >
> > >>        $curl = curl_init();
> > >>        curl_setopt($curl, CURLOPT_URL, "$tweetUrl");
> > >>        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
> > >>        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
> > >>        curl_setopt($curl, CURLOPT_POST, 1);
> > >>        curl_setopt($curl, CURLOPT_POSTFIELDS, "status=$status");
> > >>        curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
> >
> > >>        $result = curl_exec($curl);
> > >>        $resultArray = curl_getinfo($curl);
> >
> > >>        if ($resultArray['http_code'] == 200) {
> > >>                $msg += ' and was Tweeted!';
> > >>        }
> >
> > >>        curl_close($curl);
> > >>        }
> > >> }
> >
> > >>        $tweet = '';
> >
> > >>        $longURL = 'http://test.com'. $row->id;
> > >>        $shortURL = make_jmp_url($longURL, 'username', 'apikey',
> 'json');
> >
> > >>        $tweet .= urlencode( $row->title );
> >
> > >>        if (strlen($tweet) > 119) {
> > >>                // shorten status update to fit in 140 with URL
> > >>                $tweet = substr($tweet, 0, 116 ) . '...';
> > >>        }
> >
> > >>        $tweet .= ' - ';
> > >>        $tweet .= $shortURL;
> >
> > >>        tweet($tweet);
> >
> > >> ?>
> >
> > >> --
> > >> Twitter developer documentation and resources:
> http://dev.twitter.com/doc
> > >> API updates via Twitter:http://twitter.com/twitterapi
> > >> Issues/Enhancements Tracker:
> > >>http://code.google.com/p/twitter-api/issues/list
> > >> Change your membership to this group:
> > >>http://groups.google.com/group/twitter-development-talk
> >
> > > --
> > > Peter Denton
> > > Co-Founder, Product Marketing
> > >www.mombo.com
> > > cell: (206) 427-3866
> > > twitter @Mombo_movies
> > > twitter - personal: @petermdenton
> >
> > >  --
> > > Twitter developer documentation and resources:
> http://dev.twitter.com/doc
> > > API updates via Twitter:http://twitter.com/twitterapi
> > > Issues/Enhancements Tracker:
> > >http://code.google.com/p/twitter-api/issues/list
> > > Change your membership to this group:
> > >http://groups.google.com/group/twitter-development-talk
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to