Skip to content

Commit c509518

Browse files
committed
Add Repo Readme File
1 parent 57c82ed commit c509518

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## TwitterOAuth ##
2+
3+
PHP library to communicate with Twitter OAuth API version 1.1.
4+
5+
## Requirements ##
6+
7+
- PHP Version >= 5.3
8+
- PHP cURL extension
9+
10+
## Installation ##
11+
The recommended way to install TwitterOAuth is through [Composer](http://getcomposer.org/):
12+
13+
{
14+
"require": {
15+
"ricardoper/twitteroauth": "*"
16+
}
17+
}
18+
19+
## Example ##
20+
```
21+
<?php
22+
23+
use TwitterOAuth\TwitterOAuth;
24+
25+
date_default_timezone_set('UTC');
26+
27+
require_once __DIR__ . '/vendor/autoload.php';
28+
29+
/**
30+
* Array with the OAuth tokens provided by Twitter when you create application
31+
*/
32+
$config = array(
33+
'consumer_key' => '01b307acba4f54f55aafc33bb06bbbf6ca803e9a',
34+
'consumer_secret' => '926ca39b94e44e5bdd4a8705604b994ca64e1f72',
35+
'oauth_token' => 'e98c603b55646a6d22249d9b0096e9af29bafcc2',
36+
'oauth_token_secret' => '07cfdf42835998375e71b46d96b4488a5c659c2f'
37+
);
38+
39+
/**
40+
* Instantiate TwitterOAuth class with set tokens
41+
*/
42+
$tw = new TwitterOAuth($config);
43+
44+
/**
45+
* Returns a collection of the most recent Tweets posted by the user
46+
* https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
47+
*/
48+
$params = array(
49+
'screen_name' => 'username',
50+
'count' => 5,
51+
'exclude_replies' => true
52+
);
53+
54+
/**
55+
* Send a GET call with set parameters
56+
*/
57+
$response = $tw->get('statuses/user_timeline', $params);
58+
59+
var_dump($response);
60+
```

0 commit comments

Comments
 (0)