Abraham's Twitter oAuth for 1.1 API?


Does anyone know if the Twitter oAuth PHP library https://github.com/abraham/twitteroauth will be updated to support Twitter’s 1.1 API? I reached out to him but perhaps someone will fork it and update it as it doesn’t appear to have been touched in quite some time.

If not, perhaps some of us who utilize it may want to band together to fork it? Though if Abraham is working on it, that would be awesome.


you can change in file: twitteroauth.php

public $host = “https://api.twitter.com/1/”;
public $host = “https://api.twitter.com/1.1/”;

but … if i use the /1.1/ URL
i get in HEADER: [x_warning] => Invalid OAuth credentials detected
but results 're there ?


Are you using an access token with your requests? Make sure you’re using an access token and that your system clock is sync with ours.


The best way to update to the v1.1 is the following:

$connection = new TwitterOAuth(...); $connection->host = "https://api.twitter.com/1.1/";

That way you don’t have to edit twitteroauth.php.


So what exactly are you supposed to replace the dots with on line 1?


Oh, the keys right?


Thank you very much, Abraham! Finally solved it with this line!


@abraham I’m using twitteroauth to make a simple twitter account manager - thank you for releasing such an awesome library!

Every thing works beautifully with v1 api but I tried updating to 1.1 api and it’s now causing some errors - trying to perform a users/show works once but the second time the api is refusing the connection.

I ran the test.php that came with your twitteroauth github using v1.1 and it also doesn’t complete all the tasks now.

When I switch back to v1 everything works fine again.

Do you know what might be causing this?

Thanks again for twitteroauth.


I am using tweet library in codeigniter for implementing login with twitter,It has been working fine in last 1 year but now it is not working fine,How can I update API 1.0 to 1.1 for implementing login with twitter functionality or please give the link for another library for implementing the same


@WesymUser : I too have same problem. How to upgrade API 1.0 to 1.1. I am using twitter library for codeigniter… Got any updated library ?


Checkout Abrahams comments above.

$connection = new TwitterOAuth(...); $connection->host = "https://api.twitter.com/1.1/";

Then look at the examples in index.php on Git. He has put it all there for you.

Dicely, done, Abraham!


thanks my problem is Now solved.


Thank you!
It helps me a lot to resolve my issue :slight_smile:


It doesn’t seem to work for me. I have tried changing the $host variable on twitteroauth.php too.


Whereto write this code?


i change all number fromn 1.0 to 1.1 in twitteroath and oath file. then on calling back from twitter refresh the page. It hides the error :slight_smile:




There are some other better twitter api library in github




@abraham your code is not working anymore for OAuth. It always throw an Exception “Failed to validate oauth signature and token”. Maybe you must test it yourself.