-
Notifications
You must be signed in to change notification settings - Fork 0
/
sampleclient.php
43 lines (30 loc) · 889 Bytes
/
sampleclient.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
// ref. http://docs.guzzlephp.org/en/latest/
require_once 'vendor/autoload.php';
use Guzzle\Http\Client;
include __DIR__ . '/twitter-auth.php';
//$client = new Client('https://api.github.com');
//$request = $client->get('/user')->setAuth('user','pass');
//
//$response = $request->send();
//
//echo $response->getBody();
//echo $response->getHader('Content-Length');
//
//// Configuration ////
$client = new Client('https://api.twitter.com/{version}', array(
'version' => '1.1'
));
$client->addSubscriber(new Guzzle\Plugin\Oauth\OauthPlugin(
$twitterauth
));
//// Get a status ////
echo $client->get('statuses/user_timeline.json')->send()->getBody();
//// Post a status ////
//$request = $client->post('statuses/update.json', null, array(
// 'status' => 'Tweeted with Guzzle, http://guzzlephp.org'
//));
//
//$data = $request->send()->json();
//echo $data['text'];
//