The most popular PHP library for Twitter's OAuth REST API.
See documentation at https://twitteroauth.com.
PHP versions listed as "active support" or "security fixes only" are supported.
The most popular PHP library for Twitter's OAuth REST API.
See documentation at https://twitteroauth.com.
PHP versions listed as "active support" or "security fixes only" are supported.
Hi, I've done every thing with Twitter policies to have my website on Twitter's whitelist. (https://dev.twitter.com/rest/reference/get/account/verify_credentials) My app tells me it's "OK", I can get the user's email. But when I make this, I can't find any email. I did this:
$user_infos = $twitter_conn->get("account/verify_credentials", ['include_entities' => true, 'skip_status' => true, 'include_email' => true]);
Have you any suggestion to get it ? Regards
TaskWhy Me always get this error ?
[12-Apr-2015 23:38:35 UTC] PHP Fatal error: Uncaught exception 'Abraham\TwitterOAuth\TwitterOAuthException' in /home/xxx/public_html/twitteroauth/src/TwitterOAuth.php:141
Stack trace:
#0 /home/xxx/public_html/view/callback.php(23): Abraham\TwitterOAuth\TwitterOAuth->oauth('oauth/access_to...', Array)
#1 /home/xxx/public_html/page.php(24): require_once('/home/xxx/...')
#2 {main}
thrown in /home/xxx/public_html/twitteroauth/src/TwitterOAuth.php on line 141
Task Misc Available
Hi,
I've been going through loads of previous issues here to try and see if they could help with trying to get this to work for me, but I'm stumped. Sorry, I'm not a php dev, so I'm using the manual method as described :-(
require "twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
The full error is:
Fatal error: Class 'Abraham\TwitterOAuth\Config' not found in /var/www/vhosts/stagingtesting.com/subdomains/redtree.stagingtesting.com/wp-content/themes/redtree/includes/twitter/twitteroauth/src/TwitterOAuth.php on line 17
So I'm guessing I'm having paths issues.
It's a Wordpress site, so in footer.php I've got this:
<?php get_template_part('includes/twitter/get-tweets'); ?>
And it's in this get-tweets.php file that I'm requiring Twitteroauth as above. My twitteroauth directory is at the same level as this php file and the files are extracted as you described. I did a print_r on $base_dir in autoload.php and it returns this which I presume is not correct:
/var/www/vhosts/stagingtesting.com/subdomains/redtree.stagingtesting.com/wp-content/themes/redtree/includes/twitter/twitteroauth/src//var/www/vhosts/stagingtesting.com/subdomains/redtree.stagingtesting.com/wp-content/themes/redtree/includes/twitter/twitteroauth/src/
The path is double stacked.
One other thing to note is that it works on my local MAMP using php 7.1.0 but not on the live site with Shared hosting PHP 7.1 CGI (7.1.6).
Any thoughts on what's happening here? Sorry, I know you've been queried about this issue many times.
Thanks!
Hi there,
I made uploading images work as per https://dev.twitter.com/docs/api/1/post/statuses/update_with_media
You need to use $connection->upload() instead of $connection->post();
Hi abraham.. I have no problem before with the script.. it works fine last time. I used this twitter auth in my client website but now i try to use it again in my current client (Of course i registered the new app and got new code for the key and secret code). This is really strange. Because i get the error just like the title above... Everything was working very well when i try it from localhost, and my previous client nothing wrong, but this time it didnt work. My new client have his own server, using centos, 5 and he installed apache mysql and php. I believe there's nothing wrong with the code of your script. maybe there's something i have to active it from the server ?
Waiting onHi, I''m getting the following error when I try to run getRequestToken();
Message: Undefined index: oauth_token File: twitteroauth.php Line: 82
Not sure what could be wrong, I double checked my secret and api key and it should be fine. Please let me know what I can do to help debug this.
I have been struggling with the Twitter API and OAuth and tried using this plugin. Seemed to be working well for many, so I am assuming this is a simple oversight on my part perhaps.
When I do a run of the demo, when clicking the Sign in with Twitter button on the connect.php page, I am properly directed to redirect.php but I get the following message (after the getRequestToken call):
Could not connect to Twitter. Refresh the page or try again later.
I cleared the session, refreshed etc and nothing worked. I took note of a few issues logged before and tried changing my callback to a real URL, as well as tried my own key and secret. I checked out the connection object and see that the response code is 401 (Unauthorized) instead of the expected 200.
I can provide further details as needed, just seem to be having a lot of trouble with Twitter OAuth and hoped this plugin could help.
Thanks!
Suddenly all my scripts are saying this:
Fatal error: Uncaught exception 'Abraham\TwitterOAuth\TwitterOAuthException' with message 'SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' in /home/gramaco/public_html/random/twitteroauth/src/TwitterOAuth.php:403 Stack trace: #0 /home/gramaco/public_html/random/twitteroauth/src/TwitterOAuth.php(334): Abraham\TwitterOAuth\TwitterOAuth->request('https://api.twi...', 'GET', 'Authorization: ...', Array) #1 /home/gramaco/public_html/random/twitteroauth/src/TwitterOAuth.php(305): Abraham\TwitterOAuth\TwitterOAuth->oAuthRequest('https://api.twi...', 'GET', Array) #2 /home/gramaco/public_html/random/twitteroauth/src/TwitterOAuth.php(179): Abraham\TwitterOAuth\TwitterOAuth->http('GET', 'https://api.twi...', 'account/verify_...', Array) #3 /home/gramaco/public_html/random/rilkbaudtweet.php(76): Abraham\TwitterOAuth\TwitterOAuth->get('account/verify_...') #4 {main} thrown in /home/gramaco/public_html/random/twitteroauth/src/TwitterOAuth.php on line 403
I thought that maybe was a server ssl problem but no, they say everything is OK with their certificates. I'm missing something?
Waiting onHi,
Firstly, thanks for creating this - it's been incredibly simple to use.
However, I'm having difficulty in passing an object as a parameter for the new alt text support Twitter has introduced.
According to https://blog.twitter.com/2016/alt-text-support-for-twitter-cards-and-the-rest-api they want the alt text to be in this format:
{ "media_id": "650011250680795136", "alt_text": { "text": "dancing cat" } }
I've tried passing objects, arrays, using json_decode with their example string to get the right format and all sorts, and every time I get object(stdClass)#7 (2) { ["request"]=> string(31) "/1.1/media/metadata/create.json" ["error"]=> string(21) "Invalid json payload." }
back.
Currently I'm trying:
$altText = (object) ['text' => 'An image generated in the style of a medieval Herbarium']; $parameters = [ 'alt_text' => $altText, 'media_id' => $media->media_id_string ]; $result = $connection->post('media/metadata/create', $parameters);
but, as with my other attempts, getting that invalid json payload
error.
Is there a way to do this? Am I just doing something wrong?
Many thanks for any help.
Misc Available API supportNot sure why this is happening..
I am using the code below to display a twitter follower count. What's happening is it displays fine here on the script im working on > http://ngx2gaming.com/kjthadon_social/
Although once I include the file above onto the front page sidebar of the site, twitter is the only one that wont display .. As you can see here http://ngx2gaming.com/
Anyone have an idea why it wont display on my front page, but will when I access the file directly?
Thanks
<?php
require_once ('twitteroauth.php');
require_once ('OAuth.php');
$twitter_id = 'ngx2gaming';
$twitter_access_token = 'xxx';
$twitter_access_token_secret = 'xxx';
$twitter_consumer_key = 'xxx';
$twitter_consumer_secret = 'xxx';
$twitter_api = new TwitterOAuth( $twitter_consumer_key , $twitter_consumer_secret , $twitter_access_token , $twitter_access_token_secret );
$twitter_api_link = $twitter_api->get( 'users/lookup' , array ( 'screen_name' => ( $twitter_id ) ) );
$twitter_count = $twitter_api_link[0]->followers_count;
echo $twitter_count;
?>
Hi Sir
I am using the following code and library functions to use twitter API's
require "vendor/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
$consumerKey = 'vT********************RQy';
$consumerSecret = 'hdJqg*****************o************************MF0';
$accessToken = "8**********************************************a6I";
$accessSecret = "zYJ********************************************dRH";
$baseUrl = "http://******************/";
$redirectURL = 'http://******************/';
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessSecret);
$content = $connection->get("account/verify_credentials");
$connection->setTimeouts(10, 15);
echo "<pre>"; print_r($content);echo "</pre>";
$userId = "1027************96 ";
$userDtaRes = $connection->get('users/lookup ', array('screen_name' => "Easemymarketing"));
print_r("<br/> user lookup API <br/>");
var_dump("<br/>".$connection->getLastHttpCode());
var_dump("<br/>".$connection->getLastApiPath());
var_dump("<br/>".$userDtaRes);
$data = [
'event' => [
'type' => 'message_create',
'message_create' => [
'target' => [
'recipient_id' => $userId
],
'message_data' => [
'text' => "hi new dm messg to ashsi "
]
]
]
];
$result = $connection->post('direct_messages/events/new ', $data, true); // Note the true
print_r("<br/> USER send direct mesage api <br/>");
var_dump("<br/>".$connection->getLastHttpCode());
var_dump("<br/>".$result);
Always it returns NULL for each library, please guide me how to run the to fetch various API result and send the direct message event new.
Waiting onBumps rector/rector from 0.14.8 to 0.15.2.
Sourced from rector/rector's releases.
Released Rector 0.15.2
New Features :partying_face:
- [TypeDeclaration] Add FalseReturnClassMethodToNullableRector (#3229)
- [DeadCode] Add TargetRemoveClassMethodRector (#3240)
- Adapt PrivateConstantToSelfRector to work on non-final classes, too (#3198), Thanks
@alfredbez
!- [CodingStyle] Add NullifyUnionNullableRector (#3231)
- [TypeCoverage] Add EmptyOnNullableObjectToInstanceOfRector (#3230)
- RenameClassRector with callback support (#3023), Thanks
@dorrogeray
!Bugfixes :bug:
- [Php82] Handle parent already readonly on ReadOnlyClassRector (#3199)
- [DeadCode] Skip append array data on RemoveJustPropertyFetchRector (#3201)
- [DeadCode] Skip standalone
@return
false or true on RemoveUselessReturnTagRector (#3202)- Fix wrong reference to replacement rule (#3203), Thanks
@jlherren
!- [Privatization] Do not remove comment on ChangeReadOnlyPropertyWithDefaultValueToConstantRector (#3204)
- [Naming] Skip Doctrine collection with
@var
Collection on RenamePropertyToMatchTypeRector (#3209)- [Core] Performance improvement: Remove unnecessary re-call FileFactory::createFileInfosFromPaths() (#3210)
- [Php71] Skip defer() function on RemoveExtraParametersRector (#3211)
- [Core] Improve performance: remove repetitive currentFileProvider->setFile() call on PhpFileProcessor (#3213)
- [Php81] Allow explicit mixed processed on trait on NullToStrictStringFuncCallArgRector (#3212)
- [Privatization] Skip used by heredoc on ChangeReadOnlyVariableWithDefaultValueToConstantRector (#3216)
- [Parallel] Fix missing process RemovedAndAddedFilesProcessor->run() on parallel process on WorkerRunner (#3218)
- [parallel] Improve performance: Run RemovedAndAddeedFileProcessor after loop (#3219)
- [CodeQuality] Add empty() check to FlipTypeControlToUseExclusiveTypeRector (#3224)
- [CodeQuality][TypeDeclaration] Handle default value from constructor removed on InlineConstructorDefaultToPropertyRector+TypedPropertyFromStrictConstructorRector (#3225)
- [TypeDeclaration] Skip yield return on AddClosureReturnTypeRector (#3227)
- [TypeDeclaration] Skip optional yield on AddReturnTypeDeclarationFromYieldsRector (#3228)
- [NodeTraverser] Use NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN instead of NodeTraverser::DONT_TRAVERSE__CHILDREN (#3233)
- [Core] Improve performance on AstResolver and ClassLikeAstResolver (#3234)
- [Php81] Skip ReadOnlyPropertyRector on read only class (#3236)
- [CodingStyle] Skip new line /\r\n|\r|\n/i on ConsistentPregDelimiterRector (#3241)
- [CodingStyle] Skip EncapsedStringsToSprintfRector on heredoc (#3242)
Released Rector 0.15.1
New Features :partying_face:
- [CodingStyle] Split SplitGroupedConstantsAndPropertiesRector to SplitGroupedClassConstantsRector and SplitGroupedPropertiesRector (#3158)
- Add compatible phpstan/phpdoc-parser 0.15 (#3157)
Bugfixes :bug:
... (truncated)
5bc89fa
Rector 0.15.25b34b97
Updated Rector to commit f8814b1d707d72e284870759d1f446848fa003b2374d2f5
Updated Rector to commit f8814b1d707d72e284870759d1f446848fa003b25003a01
Updated Rector to commit e920ade7b67a17dbf7e6129585a3261f1fd1540ef233f27
Updated Rector to commit ab3ad293122bafa96d9e8fc64ac15f0220aa9ecc727b9f4
Updated Rector to commit bfa1891c50677b01136a9308fd3c3ecc12e267d9680ba23
Updated Rector to commit 88629427917b7d359beeb1a0b34d39d2127472b9e4dc601
Updated Rector to commit 3c168f03d38bb967a5e65e453f82adf120ef4eba96d8a22
Updated Rector to commit 70fea54e77ffd186e41540d2b36c5362b073fbc4d72c810
Updated Rector to commit c78e255cf9cb17cedead84ff8a54f421f563942dDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)What are you attempting to do Trying to update a lists meta data using a PUT request
Expected behavior The list should update
Actual behavior An error is received
}
"title": "Unauthorized"
"type": "about:blank"
"status": 401
"detail": "Unauthorized"
}
Code example
$resp = $connection->put("lists/1", ["name" => "new name", "description" => "new description, yo!", "private" => false], true);
List ID omitted for security reasons/
Versions:
Additional context The same request does work via Postman
Bug TriageWhat are you attempting to do Add rules to Filtered Stream
Expected behavior Return a array with the rules
Actual behavior
Return a 403
object(stdClass)#4 (4) {
["title"]=>
string(26) "Unsupported Authentication"
["detail"]=>
string(141) "Authenticating with OAuth 1.0a User Context is forbidden for this endpoint. Supported authentication types are [OAuth 2.0 Application-Only]."
["type"]=>
string(61) "https://api.twitter.com/2/problems/unsupported-authentication"
["status"]=>
int(403)
}
Code example
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token, $access_token_secret);
$connection->setApiVersion('2');
$rules_arr=[
'add' =>
[
'value' => 'term1',
],
[
'value' => 'term2',
],
];
$result = $connection->post('tweets/search/stream/rules/',$rules_arr,true);
var_dump($result);
Versions:
Additional context Add any other context about the problem here.
Bug TriageThe API endpoints for managing subtitles associated with video files (media/subtitles/create and media/subtitles/delete) are not yet covered by this library. This pull request adds support for those endpoints.
random_int
apiUrl
to protected. Overriding apiUrl
is not officially supported.$connection = new TwitterOAuth(...);
$connection->setApiVersion('2');
$response = $connection->get('users', ['ids' => 12]);
Source code(tar.gz)1.x is the last version to support PHP versions < 7.2. 1.x will get critical security and bug fixes while feature development will go toward a future 2.x release.
Source code(tar.gz)boolean
to 'boolean'
setChunkSize
to set the chunk size for file uploadsUse system TLS certificates when in PHAR compression format.
Source code(tar.gz)setGzipEncoding
methodChunked media upload bugfix.
Source code(tar.gz)PHP 5.4 is no longer supported.
Source code(tar.gz)Remove misused CURLOPT_CAPATH
parameter.
Updated TLS root certificates.
Source code(tar.gz)Always specify Accepts: application/json
and minor bug fixes.
chillerlan/php-oauth-providers Documentation See the wiki for advanced documentation. Requirements PHP 7.4+ a PSR-18 compatible HTTP client library of
PHPoAuthLib NOTE: I'm looking for someone who could help to maintain this package alongside me, just because I don't have a ton of time to devote to i
README The Wid'op OAuth library is a modern PHP 5.3+ API allowing you to easily obtain a Twitter access token. For now, it supports OAuth Web & Applic
Introduction Laravel Socialite provides an expressive, fluent interface to OAuth authentication with Facebook, Twitter, Google, LinkedIn, GitHub, GitL
EAuth extension allows to authenticate users with accounts on other websites. Supported protocols: OpenID, OAuth 1.0 and OAuth 2.0.
Twitter SDK Installation composer require lyrixx/twitter-sdk Usage Create a twitter application then <?php require __DIR__.'/vendor/autoload.php';
PHPoAuthLib NOTE: I'm looking for someone who could help to maintain this package alongside me, just because I don't have a ton of time to devote to i
Hybridauth 3.7.1 Hybridauth enables developers to easily build social applications and tools to engage websites visitors and customers on a social lev
Salla Provider for OAuth 2.0 Client This package provides Salla OAuth 2.0 support for the PHP League's OAuth 2.0 Client. To use this package, it will
WP REST API - OAuth 1.0a Server Connect applications to your WordPress site without ever giving away your password. This plugin uses the OAuth 1.0a pr
PHP OAuth 2.0 Server league/oauth2-server is a standards compliant implementation of an OAuth 2.0 authorization server written in PHP which makes work
What is Kaiju? Kaiju is an open source verification bot for Discord servers, based on OAuth and with permission for the server owner, to be able to mi
OAuth 2.0 Client This package provides a base for integrating with OAuth 2.0 service providers. The OAuth 2.0 login flow, seen commonly around the web
OAuth 1.0 Client OAuth 1 Client is an OAuth RFC 5849 standards-compliant library for authenticating against OAuth 1 servers. It has built in support f
HWIOAuthBundle The HWIOAuthBundle adds support for authenticating users via OAuth1.0a or OAuth2 in Symfony. Note: this bundle adds easy way to impleme
OAuth 2.0 Server for Laravel (deprecated for Laravel 5.3+) Note: This package is no longer maintaned for Laravel 5.3+ since Laravel now features the P
OAuth FreeScout This module is intended to provide oauth authentication to freescout. Module was tested on keycloak oauth provider with confidential o
laravel-social A Laravel 5 package for OAuth Social Login/Register implementation using Laravel socialite and (optionally) AdminLTE Laravel package. I
OAuth wrapper for Laravel 4 oauth-4-laravel is a simple laravel 4 service provider (wrapper) for Lusitanian/PHPoAuthLib which provides oAuth support i