https://github.com/micc83/twitter-api-1.1-client-for-wordpress
A simple class to query Twitter API v1.1 from WordPress with caching
https://github.com/micc83/twitter-api-1.1-client-for-wordpress
Last synced: about 1 year ago
JSON representation
A simple class to query Twitter API v1.1 from WordPress with caching
- Host: GitHub
- URL: https://github.com/micc83/twitter-api-1.1-client-for-wordpress
- Owner: micc83
- Created: 2013-06-12T16:01:41.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-11-15T13:52:09.000Z (over 12 years ago)
- Last Synced: 2025-04-06T19:07:22.573Z (about 1 year ago)
- Language: PHP
- Size: 239 KB
- Stars: 38
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Twitter API 1.1 Client for Wordpress
====================================
A simple class to query Twitter API v1.1 from WordPress with caching.
## Documentation
As first go to https://dev.twitter.com/apps, create an application and get both **consumer_key** and **consumer_secret**.
After that just include **class-wp-twitter-api.php** in your plugin or theme folder.
That's it, check the following example, to understand how Wp_Twitter_Api works.
### Example
```php
'xxxxxxxxxxxxxxxx',
'consumer_secret' => 'xxxxxxxxxxxxxxxx'
);
// Let's instantiate Wp_Twitter_Api with your credentials
$twitter_api = new Wp_Twitter_Api( $credentials );
// Example a - Retrieve last 5 tweets from my timeline (default type statuses/user_timeline)
$query = 'count=5&include_entities=true&include_rts=true&screen_name=micc1983';
var_dump( $twitter_api->query( $query ) );
// Example b - Retrieve my follower with a cache of 24 hour (default 30 minutes)
$query = 'screen_name=micc1983';
$args = array(
'type' => 'users/show',
'cache' => ( 24 * 60 * 60 )
);
$result = $twitter_api->query( $query, $args );
echo $result->followers_count;
```
For a full list of Twitter API 1.1 resources check here: https://dev.twitter.com/docs/api/1.1 while for testing you can take advantage of Twitter API Console here: https://dev.twitter.com/console
## Support and contacts
If you need support you can find me on [twitter](https://twitter.com/Micc1983) or comment on the dedicated page on my [website](http://codeb.it/come-accedere-alle-nuove-api-1-1-di-twitter-con-wordpress/).
## Changelog
* Fixed a bug of transients not handling correctly unicode characters, pointed out by [Justin Hebb](http://wwww.jukah.com) on http://codeb.it/come-accedere-alle-nuove-api-1-1-di-twitter-con-wordpress/#comment-294
## Notes
If you get the error `SSL3_GET_SERVER_CERTIFICATE:certificate verify failed` give a look to the smart solution figured out by @franz-josef-kaiser [here](https://plus.google.com/107110219316412982437/posts/gTdK4MrnKUa).
```php
add_filter( 'https_ssl_verify', '__return_false' );
add_filter( 'https_local_ssl_verify', '__return_false' );
```
Thank you @pdewouters for pointing it out!