game mobile 12guns yoyo chat quan legging hoi fa theme wordpress chuyen vo chong winplay tai winplay download winplay game winplay winplay online cach tri mun nhanh nhat cach tri mun ruoi cach tri mun tot nhat

Twitter Oauth Connect PHP Class

July 13th, 2010 | posted in projects | 8 Comments »

As I found many of the available PHP libraries too complicated, I decided to write small and only one PHP class for connecting with the Twitter API via Oauth. I used several ideas from the already available classes and libraries, and I came up with this one. See the demo and download it if you want.

Download

Download here version 1.0. It’s .tar.gz archive including 5 files.

Demo

See the demo pages I’ve setup here. The access tokens are saved in session and not stored permanently.

How to use it?

In order to use this class you need to register an application on Twitter. You can do that here. After you register your app, you will need to download the archive file and extract it and upload the files to your web server.

Configuring

Open the file TwitterOauthConnect.php and change the details describing you app, that is the Consumer Key, Consumer Secret, and the callback url to point to the callback.php file. Use the rest of the files from the archive to configure your installation by your needs.

Licence

No license. Use it freely and if you find it useful consider linking to this website.

Contributing

Right now the comments are the only option. Maybe in the future I will consider any public free source control hosting.

Bookmark and Share

Tags: , ,

8 Comments

i have a one error i printed the vars and this show:

Array ( [
Request Entity Too Large
The requested resource
/oauth/request_token
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
Request Entity Too Large

Your browser sent a request that this server could not understand.
] => ) exception ‘Exception’ with message ‘No temporary oauth_token received, error in getAuthorizeUrl()’ in /home/betaorg/public_html/unTechoMap/twitter/TwitterOauthConnect.php:135 Stack trace: #0 /home/betaorg/public_html/unTechoMap/twitter/connect.php(8): TwitterOauthConnect->getAuthorizeUrl() #1 {main}

Thanks

Commented on: 21.12.2010 at 20:53

Hi, when i used this code in my website and clicked on connect, iam getting an error like:

Fatal error: Uncaught exception ‘Exception’ with message ‘No temporary oauth_token received, error in getAuthourizeUrl()’ in /home2/clientde/public_html/terefi/twitter_connect/TwitterOauthConnect.php:136 Stack trace: #0 /home2/clientde/public_html/terefi/twitter_connect/connect.php(8):

Do i need to change the consumer key and secret? Please help.

Commented on: 27.12.2010 at 09:09

@ shashi You should put your own consumer key and secret.

Commented on: 27.12.2010 at 09:16

Hey bro,, your code is quiet simple to use. I like it. But I get the same error as above, eventhough I’ve already insert my own key..

The error msg is :
Fatal error: Uncaught exception ‘Exception’ with message ‘No temporary oauth_token received, error in getAuthourizeUrl()’ in /home/aaa/public_html/toc/TwitterOauthConnect.php:134 Stack trace: #0 /home/aaa/public_html/toc/connect.php(8): TwitterOauthConnect->getAuthorizeUrl() #1 {main} thrown in /home/aaa/public_html/toc/TwitterOauthConnect.php on line 134

Commented on: 20.01.2011 at 03:59

Hi,
I am getting error “Request Entity Too Large” in response.
Kindly help me as soon as possible.

Thanks

Commented on: 01.07.2011 at 17:41

Hi,

Even though I put my own consumer key and secret. I got the error as above….

Fatal error: Uncaught exception ‘Exception’ with message ‘No temporary oauth_token received, error in getAuthourizeUrl()’ in /home/projec23/public_html/twitteroauthconnect/TwitterOauthConnect.php:134 Stack trace: #0 /home/projec23/public_html/twitteroauthconnect/connect.php(8): TwitterOauthConnect->getAuthorizeUrl() #1 {main} thrown in /home/projec23/public_html/twitteroauthconnect/TwitterOauthConnect.php on line 134

please help ASAP. Thanks In Advance!

Commented on: 26.07.2011 at 09:07

Nice and simple. I just tried locally and I’m getting the “No temporary oauth_token received” error also. If I try the same code on my development server, it works just fine. Anyone figure out how to get it working on a local machine?

Commented on: 14.01.2012 at 22:12

Hi,
My 2 cents on the ‘No temporary oauth_token received, error in getAuthourizeUrl()’ issue.
As I’ve encountered the same issue, and after searching for a while, I eventually find this solution:
on the httpRequest() method, I modify the ‘switch’ block, like this :
switch ($method) {
case ‘POST’:
curl_setopt($ci, CURLOPT_POST, TRUE);
if (!empty($postfields)) {
curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
}else{
curl_setopt($ci, CURLOPT_POSTFIELDS, “”);/*that’s the change*/
}
break;
case ‘DELETE’:
curl_setopt($ci, CURLOPT_CUSTOMREQUEST, ‘DELETE’);
if (!empty($postfields)) {
$url = “{$url}?{$postfields}”;
}
}

And now, everything works fine!

Best

Commented on: 14.10.2012 at 22:55

Leave a Comment