Is there any simple way of interfacing with Twitter/OAuth using PHP? - php

I am losing my mind here.
Im looking at a beginners OAuth php package that has a 700 line file. Im used to using 10-12 lines of CURL or just a couple lines with simpleXML to get the same data. Is there a very meat and potatoes way to convey the concepts of interfacing with twitter via oauth without totally alienating someone?
Im used to learning by downloading an example, and tooling around with it. The only examples i can find are so confusing that id have to take a course to begin to understand the DEMO.
Specific Question:
I have a users access token. The api address is
http://twitter.com/statuses/friends_timeline.xml
How do i take the token, and mash it into the address and make that give me the data that i want? Im willing to learn, but i cant learn if i dont understand what is going on to begin with. I get the basics, you send a request, user approves, you get a token, i get that. I dont get how you make the requests with your token as authorization in place of the plain text user and pass.

Have you considered looking at one of the Twitter API PHP libraries listed on the Twitter API wiki?

I felt exactly the same, but then I found EpiTwitter which makes the whole process much, much easier. Checkout the authors blog for specific examples that actually work :)

I haven't tried this library, but someone posted a link to simple OAuth library few day ago here.

Related

Appmobi Codeigniter and Facebook SDK JavaScript vs PHP

Ok, this isn't going to be the best quality question without a doubt. But I am looking for advice mostly on how to handle the next phase of an app I am developing. This is my first app in appmobi so things with it are a bit confusing to me still.
So generally speaking I am very used to working with PHP and sticking to browser based development. With that most of what I want to do with Facebook as far as the API's go for the graph I have done using the PHP FB-SDK. If your familiar with Appmobi then you know php is out well directly at least.
This app I am making, I have it working fine with everything else I am doing. I'm communicating with my server, people are logging in, people are registering, people are using the server for what its worth. But this Facebook bit has me stumpped. I want to offer facebook as a means of login/registration for my app, I want to post to facebook from my app pending a user approves it, and a handful of other things. But I dunno the best way to approach this through the app as its all static html based pages and javascript thus far.
So I am hoping someone will read through this all, and hopefully a handful of you that do, will know some means of doing what I want to do, Im not looking for someone to drop me a pile of code and give me the answer (nice as that would be). No I am just simply looking for what I should do to handle this between all the layers mentioned here to make this work. So I can start building this piece up.
Regarding Facebook, appMobi has recently added a Facebook object to the API you might use to be able to log into Facebook and access the Facebook Graph. You can find the Facebook API documentation here:
http://www.appmobi.com/documentation/jsAPI/facebook/index.html
There is a supporting document illustrating how to set up things on Facebook's side that can be found here:
http://www.appmobi.com/documentation/index.php?DOC=FACEBOOK_INTEGRATION
I'll do my best to post some sample code as well. I'm kind of working through the exact same thing.

What is the simplest way to add, modify, delete Google Calendar events/calendars in PHP?

I've been on this one for the last 2 days...
All I want to do is, with my username and password, access my Google Calendar events/calendars and create, edit or delete them with my PHP web application.
I've looked in the Google API, Zend Framework, OAuth 2.0 with google, etc and there is always a piece of information missing to make it work.
What is the quickest and simplest way, on a shared server to get to access my gcalendar? Is there a class/php function file somewhere that I can simply install in a www.websitename.com/include directory that will not make me want to pull my hair out?
I want to use already made functions like this : updateevent(username, pass, id, calendar, title, details, location, etc);
New APIs can be a little scary, especially to programmers who are still somewhat new to a particular platform. Google's Calendar API is very well-documented (like all of them) -- but you just have to read them. It's easy once you get used to it.
http://code.google.com/apis/calendar/v3/using.html
It basically involves this:
Acquire an API key
Include two files in your PHP code
Authenticate (steps up to this point only take a few lines of code)
Do what you need to do!
It's the only official and truly the easiest way to directly work with Google Calendar. What piece of information is still missing?

Integrate Dropbox into my website

I've done some googling around on this topic, but there seems to be only one option: the Dropbox official API. Is there no other way i could do some sort of JSON/PHP get_file_contents etc, when you get tweets from twitter you can use the user_timeline, is there no alternative for Dropbox people have come across. I just want something i can put a username and password into the PHP script and have it get the files (or am i dreaming and will have to use the API)
Check out the Dropbox PHP SDK it uses OAuth for validation which is the safest way.
You're dreaming and will have to use the API. This is exactly what API's are for, for programming applications to talk to applications. Specifically on the subject of authentication, there would be so many security issues with just having a user/pass in your code it's not even funny. Things like OAuth and other API authentication methods exist to make this kind of thing safer and saner. Sort of like lighting a campfire in a firepit instead of the middle of a dry grassland.
There are libraries like the one fire mentions that can wrap the API and make it easier to access from your language, but you need to play by the rulebook here. I know it sounds daunting but your application will be the better for doing it right.
You could also use the hosting service KISSR which would allow you to host your entire site out of Dropbox. This would be simpler than using the API but you wouldn't be able to use PHP.
it is not that much of a odd question that has been asked. as if you are using two hosting services one of them for just hosting images the other is for interaction events, done gazillions of time, some servers use term 'content/image leeching', hard to differenciate legit useage. however thats what consumer is asking/requesting, funny answers

Simple way for read only twitter api usage

probably like many people my site has been affected by twitter deprecating basic authentication, so I was looking at implementing OAuth. But all I want to do is just pull the last couple of tweets from my account - I don't need to post anything, it's just readonly access to the user timeline. I've seen a couple of posts showing how to do this easily with javascript, so i'm thinking it might also be similarly straightforward with PHP (i.e not requiring OAuth)? One reason for having to use PHP instead of Javascript is that i need to check when the rate limit is about to be exceeded, then I cache the last couple of tweets for the required amount of time.
If OAuth is the best solution, I'll get on with that - grateful for any suggestions though!
I wrote a article showing how to do this:
http://philsturgeon.co.uk/news/2009/07/How-to-Create-a-Twitter-feed-with-full-syntax-support
but the basics are even easier. It all boils down to:
$tweets = json_decode(
file_get_contents('http://twitter.com/statuses/user_timeline/philsturgeon.json?count=10')
);
Enjoy.

Using the Twitter API

I am trying to build a small useful application with twitter. I will publish it as an open source project once I am done. I am trying to decide what is the best way to do the following:
I want to get the latest 200 tweets from Washington for example and see the most important thing these 200 tweets share. For example, if 20 tweets have tweeted the same link, this is probably an important story in Washington. Or if 50 tweets mentioned (This specific subject) it means this is important and I could get information about it.
What is the best way to do that? and is there a better way to get this information without getting the latest 200 tweets (except trends).
If you feel like this is not clear enough please provide some questions and I will clear this up
Thank you all for the help.
I don't think there is going to be any "custom" trending available, so you are going to have to parse out the links from the search results yourself.
You would use the search api function:
http://search.twitter.com/search.atom?geocode=40.757929%2C-73.985506%2C25km
After that, it should be pretty trivial to maintain a list of trends and links over the past 24 hours.
I would suggest you use a php twitter library which does already the things you wrote.
Please have a look at this question to find a library which fits your needs https://stackoverflow.com/questions/422879/best-twitter-php-library

Categories