Last active
December 11, 2015 16:08
-
-
Save donaldallen/4625340 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Routes.php | |
use Guzzle\Http\Client; | |
use Guzzle\Plugin\Oauth\OauthPlugin; | |
Route::get('/', function() | |
{ | |
$client = new Client('http://api.twitter.com/1.1'); | |
$oauth = new OauthPlugin(array( | |
'consumer_key' => '-', | |
'consumer_secret' => '-', | |
'token' => '-', | |
'token_secret' => '-' | |
)); | |
$client->addSubscriber($oauth); | |
$response = $client->get('statuses/user_timeline.json?screen_name=twitterapi')->send(); | |
print_r($response); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Response | |
Guzzle\Http\Message\Response Object | |
( | |
[body:protected] => Guzzle\Http\EntityBody Object | |
( | |
[contentEncoding:protected] => | |
[rewindFunction:protected] => | |
[stream:protected] => Resource id #142 | |
[size:protected] => 50619 | |
[cache:protected] => Array | |
( | |
[wrapper_type] => php | |
[stream_type] => temp | |
[mode] => w+b | |
[unread_bytes] => 0 | |
[seekable] => 1 | |
[uri] => php://temp | |
[is_local] => 1 | |
[is_readable] => 1 | |
[is_writable] => 1 | |
) | |
) | |
[reasonPhrase:protected] => OK | |
[statusCode:protected] => 200 | |
[protocol:protected] => HTTP | |
[info:protected] => Array | |
( | |
[url] => http://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi | |
[content_type] => application/json;charset=utf-8 | |
[http_code] => 200 | |
[header_size] => 684 | |
[request_size] => 470 | |
[filetime] => -1 | |
[ssl_verify_result] => 0 | |
[redirect_count] => 0 | |
[total_time] => 0.872482 | |
[namelookup_time] => 0.3966 | |
[connect_time] => 0.417158 | |
[pretransfer_time] => 0.417205 | |
[size_upload] => 0 | |
[size_download] => 50619 | |
[speed_download] => 58017 | |
[speed_upload] => 0 | |
[download_content_length] => 50619 | |
[upload_content_length] => 0 | |
[starttransfer_time] => 0.587279 | |
[redirect_time] => 0 | |
[certinfo] => Array | |
( | |
) | |
[primary_ip] => 199.59.150.41 | |
[primary_port] => 80 | |
[local_ip] => 172.24.10.109 | |
[local_port] => 52781 | |
[redirect_url] => | |
) | |
[request:protected] => Guzzle\Http\Message\Request Object | |
( | |
[eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object | |
( | |
[listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array | |
( | |
[request.sent] => Array | |
( | |
[100] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Http\RedirectPlugin Object | |
( | |
[defaultMaxRedirects:protected] => 5 | |
) | |
[1] => onRequestSent | |
) | |
) | |
) | |
[request.clone] => Array | |
( | |
[0] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Http\RedirectPlugin Object | |
( | |
[defaultMaxRedirects:protected] => 5 | |
) | |
[1] => onRequestClone | |
) | |
) | |
) | |
[request.before_send] => Array | |
( | |
[-1000] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Plugin\Oauth\OauthPlugin Object | |
( | |
[config:protected] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
[version] => 1.0 | |
[consumer_key] => - | |
[consumer_secret] => - | |
[signature_method] => HMAC-SHA1 | |
[signature_callback] => Closure Object | |
( | |
[this] => Guzzle\Plugin\Oauth\OauthPlugin Object | |
*RECURSION* | |
[parameter] => Array | |
( | |
[$stringToSign] => <required> | |
[$key] => <required> | |
) | |
) | |
[token] => - | |
[token_secret] => - | |
) | |
) | |
) | |
[1] => onRequestBeforeSend | |
) | |
) | |
) | |
[request.error] => Array | |
( | |
[-255] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Http\Message\Request | |
[1] => onRequestError | |
) | |
) | |
) | |
) | |
[sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array | |
( | |
[request.before_send] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Plugin\Oauth\OauthPlugin Object | |
( | |
[config:protected] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
[version] => 1.0 | |
[consumer_key] => - | |
[consumer_secret] => - | |
[signature_method] => HMAC-SHA1 | |
[signature_callback] => Closure Object | |
( | |
[this] => Guzzle\Plugin\Oauth\OauthPlugin Object | |
*RECURSION* | |
[parameter] => Array | |
( | |
[$stringToSign] => <required> | |
[$key] => <required> | |
) | |
) | |
[token] => - | |
[token_secret] => - | |
) | |
) | |
) | |
[1] => onRequestBeforeSend | |
) | |
) | |
[request.sent] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Http\RedirectPlugin Object | |
( | |
[defaultMaxRedirects:protected] => 5 | |
) | |
[1] => onRequestSent | |
) | |
) | |
) | |
) | |
[url:protected] => Guzzle\Http\Url Object | |
( | |
[scheme:protected] => http | |
[host:protected] => api.twitter.com | |
[port:protected] => 80 | |
[username:protected] => | |
[password:protected] => | |
[path:protected] => /1.1/statuses/user_timeline.json | |
[fragment:protected] => | |
[query:protected] => Guzzle\Http\QueryString Object | |
( | |
[fieldSeparator:protected] => & | |
[valueSeparator:protected] => = | |
[prefix:protected] => ? | |
[urlEncode:protected] => 1 | |
[aggregator:protected] => Array | |
( | |
[0] => Guzzle\Http\QueryString | |
[1] => aggregateUsingPhp | |
) | |
[data:protected] => Array | |
( | |
[screen_name] => twitterapi | |
) | |
) | |
) | |
[method:protected] => GET | |
[client:protected] => Guzzle\Http\Client Object | |
( | |
[defaultHeaders:protected] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
) | |
) | |
[userAgent:protected] => | |
[config:Guzzle\Http\Client:private] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
[curl.options] => Array | |
( | |
[10065] => /Users/dallen/Documents/Websites/EJ Twitter Feed/www/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem | |
[64] => 1 | |
[81] => 2 | |
) | |
) | |
) | |
[baseUrl:Guzzle\Http\Client:private] => http://api.twitter.com/1.1 | |
[curlMulti:Guzzle\Http\Client:private] => Guzzle\Http\Curl\CurlMulti Object | |
( | |
[multiHandle:protected] => Resource id #135 | |
[state:protected] => idle | |
[requests:protected] => Array | |
( | |
) | |
[requestCache:protected] => | |
[handles:protected] => SplObjectStorage Object | |
( | |
[storage:SplObjectStorage:private] => Array | |
( | |
) | |
) | |
[resourceHash:protected] => Array | |
( | |
) | |
[exceptions:protected] => Array | |
( | |
) | |
[removeHandles:protected] => Array | |
( | |
) | |
[multiErrors:protected] => Array | |
( | |
[1] => Array | |
( | |
[0] => CURLM_BAD_HANDLE | |
[1] => The passed-in handle is not a valid CURLM handle. | |
) | |
[2] => Array | |
( | |
[0] => CURLM_BAD_EASY_HANDLE | |
[1] => An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle. | |
) | |
[3] => Array | |
( | |
[0] => CURLM_OUT_OF_MEMORY | |
[1] => You are doomed. | |
) | |
[4] => Array | |
( | |
[0] => CURLM_INTERNAL_ERROR | |
[1] => This can only be returned if libcurl bugs. Please report it to us! | |
) | |
) | |
[scope:Guzzle\Http\Curl\CurlMulti:private] => -1 | |
[eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object | |
( | |
[listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array | |
( | |
) | |
[sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array | |
( | |
) | |
) | |
) | |
[uriTemplate:Guzzle\Http\Client:private] => Guzzle\Parser\UriTemplate\UriTemplate Object | |
( | |
[template:Guzzle\Parser\UriTemplate\UriTemplate:private] => statuses/user_timeline.json?screen_name=twitterapi | |
[variables:Guzzle\Parser\UriTemplate\UriTemplate:private] => Array | |
( | |
[curl.options] => Array | |
( | |
[10065] => /Users/dallen/Documents/Websites/EJ Twitter Feed/www/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem | |
[64] => 1 | |
[81] => 2 | |
) | |
) | |
) | |
[requestFactory:protected] => Guzzle\Http\Message\RequestFactory Object | |
( | |
[requestClass:protected] => Guzzle\Http\Message\Request | |
[entityEnclosingRequestClass:protected] => Guzzle\Http\Message\EntityEnclosingRequest | |
) | |
[eventDispatcher:protected] => Symfony\Component\EventDispatcher\EventDispatcher Object | |
( | |
[listeners:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array | |
( | |
[request.sent] => Array | |
( | |
[100] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Http\RedirectPlugin Object | |
( | |
[defaultMaxRedirects:protected] => 5 | |
) | |
[1] => onRequestSent | |
) | |
) | |
) | |
[request.clone] => Array | |
( | |
[0] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Http\RedirectPlugin Object | |
( | |
[defaultMaxRedirects:protected] => 5 | |
) | |
[1] => onRequestClone | |
) | |
) | |
) | |
[request.before_send] => Array | |
( | |
[-1000] => Array | |
( | |
[0] => Array | |
( | |
[0] => Guzzle\Plugin\Oauth\OauthPlugin Object | |
( | |
[config:protected] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
[version] => 1.0 | |
[consumer_key] => - | |
[consumer_secret] => - | |
[signature_method] => HMAC-SHA1 | |
[signature_callback] => Closure Object | |
( | |
[this] => Guzzle\Plugin\Oauth\OauthPlugin Object | |
*RECURSION* | |
[parameter] => Array | |
( | |
[$stringToSign] => <required> | |
[$key] => <required> | |
) | |
) | |
[token] => - | |
[token_secret] => - | |
) | |
) | |
) | |
[1] => onRequestBeforeSend | |
) | |
) | |
) | |
) | |
[sorted:Symfony\Component\EventDispatcher\EventDispatcher:private] => Array | |
( | |
) | |
) | |
) | |
[response:protected] => Guzzle\Http\Message\Response Object | |
*RECURSION* | |
[responseBody:protected] => | |
[state:protected] => complete | |
[username:protected] => | |
[password:protected] => | |
[curlOptions:protected] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
[10065] => /Users/dallen/Documents/Websites/EJ Twitter Feed/www/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem | |
[64] => 1 | |
[81] => 2 | |
) | |
) | |
[headers:protected] => Array | |
( | |
[host] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[Host] => Array | |
( | |
[0] => api.twitter.com | |
) | |
) | |
[header:protected] => Host | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[user-agent] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[User-Agent] => Array | |
( | |
[0] => Guzzle/3.1.1 curl/7.24.0 PHP/5.4.4 | |
) | |
) | |
[header:protected] => User-Agent | |
[glue:protected] => , | |
[stringCache:protected] => Guzzle/3.1.1 curl/7.24.0 PHP/5.4.4 | |
[arrayCache:protected] => Array | |
( | |
[0] => Guzzle/3.1.1 curl/7.24.0 PHP/5.4.4 | |
) | |
) | |
[authorization] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[Authorization] => Array | |
( | |
[0] => OAuth oauth_consumer_key="-", oauth_nonce="-", oauth_signature="%-%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1359048111", oauth_token="-", oauth_version="1.0" | |
) | |
) | |
[header:protected] => Authorization | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
) | |
[params:protected] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
[curl_handle] => Guzzle\Http\Curl\CurlHandle Object | |
( | |
[options:protected] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
[10002] => http://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi | |
[78] => 10 | |
[19913] => 0 | |
[42] => 0 | |
[10018] => Guzzle/3.1.1 curl/7.24.0 PHP/5.4.4 | |
[3] => 80 | |
[10023] => Array | |
( | |
[0] => Accept: | |
[1] => Host: api.twitter.com | |
[2] => User-Agent: Guzzle/3.1.1 curl/7.24.0 PHP/5.4.4 | |
[3] => Authorization: OAuth oauth_consumer_key="-", oauth_nonce="-", oauth_signature="%-%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1359048111", oauth_token="-", oauth_version="1.0" | |
) | |
[20079] => Array | |
( | |
[0] => Guzzle\Http\Curl\RequestMediator Object | |
( | |
[request:protected] => Guzzle\Http\Message\Request Object | |
*RECURSION* | |
[emitIo:protected] => | |
[curlHandle:protected] => Guzzle\Http\Curl\CurlHandle Object | |
*RECURSION* | |
) | |
[1] => receiveResponseHeader | |
) | |
[84] => 2 | |
[64] => 1 | |
[81] => 2 | |
[20011] => Array | |
( | |
[0] => Guzzle\Http\Curl\RequestMediator Object | |
( | |
[request:protected] => Guzzle\Http\Message\Request Object | |
*RECURSION* | |
[emitIo:protected] => | |
[curlHandle:protected] => Guzzle\Http\Curl\CurlHandle Object | |
*RECURSION* | |
) | |
[1] => writeResponseBody | |
) | |
[80] => 1 | |
[10065] => /Users/dallen/Documents/Websites/EJ Twitter Feed/www/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem | |
) | |
) | |
[handle:protected] => | |
[errorNo:protected] => 0 | |
) | |
) | |
) | |
[cacheControl:Guzzle\Http\Message\AbstractMessage:private] => Array | |
( | |
) | |
[protocolVersion:protected] => 1.1 | |
) | |
[cacheResponseCodes:protected] => Array | |
( | |
[0] => 200 | |
[1] => 203 | |
[2] => 206 | |
[3] => 300 | |
[4] => 301 | |
[5] => 410 | |
) | |
[previous:protected] => | |
[headers:protected] => Array | |
( | |
[content-type] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[content-type] => Array | |
( | |
[0] => application/json;charset=utf-8 | |
) | |
) | |
[header:protected] => content-type | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[date] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[date] => Array | |
( | |
[0] => Thu, 24 Jan 2013 17:21:52 GMT | |
) | |
) | |
[header:protected] => date | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[expires] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[expires] => Array | |
( | |
[0] => Tue, 31 Mar 1981 05:00:00 GMT | |
) | |
) | |
[header:protected] => expires | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[last-modified] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[last-modified] => Array | |
( | |
[0] => Thu, 24 Jan 2013 17:21:52 GMT | |
) | |
) | |
[header:protected] => last-modified | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[pragma] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[pragma] => Array | |
( | |
[0] => no-cache | |
) | |
) | |
[header:protected] => pragma | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[server] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[server] => Array | |
( | |
[0] => tfe | |
) | |
) | |
[header:protected] => server | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[status] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[status] => Array | |
( | |
[0] => 200 OK | |
) | |
) | |
[header:protected] => status | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[x-access-level] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[x-access-level] => Array | |
( | |
[0] => read | |
) | |
) | |
[header:protected] => x-access-level | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[x-frame-options] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[x-frame-options] => Array | |
( | |
[0] => SAMEORIGIN | |
) | |
) | |
[header:protected] => x-frame-options | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[x-rate-limit-limit] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[x-rate-limit-limit] => Array | |
( | |
[0] => 180 | |
) | |
) | |
[header:protected] => x-rate-limit-limit | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[x-rate-limit-remaining] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[x-rate-limit-remaining] => Array | |
( | |
[0] => 168 | |
) | |
) | |
[header:protected] => x-rate-limit-remaining | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[x-rate-limit-reset] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[x-rate-limit-reset] => Array | |
( | |
[0] => 1359048382 | |
) | |
) | |
[header:protected] => x-rate-limit-reset | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[x-transaction] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[x-transaction] => Array | |
( | |
[0] => c09dfaf52340ef1e | |
) | |
) | |
[header:protected] => x-transaction | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[cache-control] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[Cache-Control] => Array | |
( | |
[0] => no-cache, no-store, must-revalidate, pre-check=0, post-check=0, proxy-revalidate | |
) | |
) | |
[header:protected] => Cache-Control | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => Array | |
( | |
[0] => no-cache, no-store, must-revalidate, pre-check=0, post-check=0, proxy-revalidate | |
) | |
) | |
[content-length] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[content-length] => Array | |
( | |
[0] => 50619 | |
) | |
) | |
[header:protected] => content-length | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[connection] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[Connection] => Array | |
( | |
[0] => Keep-Alive | |
) | |
) | |
[header:protected] => Connection | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
[set-cookie] => Guzzle\Http\Message\Header Object | |
( | |
[values:protected] => Array | |
( | |
[Set-Cookie] => Array | |
( | |
[0] => guest_id=v1%3A135904811210150213; Expires=Sat, 24-Jan-2015 17:21:52 GMT; Path=/; Domain=.twitter.com | |
[1] => lang=en | |
) | |
) | |
[header:protected] => Set-Cookie | |
[glue:protected] => , | |
[stringCache:protected] => | |
[arrayCache:protected] => | |
) | |
) | |
[params:protected] => Guzzle\Common\Collection Object | |
( | |
[data:protected] => Array | |
( | |
) | |
) | |
[cacheControl:Guzzle\Http\Message\AbstractMessage:private] => Array | |
( | |
[no-cache] => 1 | |
[no-store] => 1 | |
[must-revalidate] => 1 | |
[pre-check] => 0 | |
[post-check] => 0 | |
[proxy-revalidate] => 1 | |
) | |
[protocolVersion:protected] => 1.1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment