Class Codebird
A Twitter library in PHP.
public
|
|
public static
|
#
getInstance( )
Returns singleton class instance Always use this method unless you're working with multiple authenticated users at once |
public static
|
|
public static
|
|
public
string
|
|
public
|
|
public
boolean
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
array
|
#
getApiMethods( )
Get allowed API methods, sorted by GET or POST Watch out for multiple-method API methods! |
public
string
|
|
protected
array
|
|
protected
array
|
#
_stringifyNullBoolParams( array $apiparams )
Replace null and boolean parameters with their string representations |
protected
string[]
|
#
_mapFnToApiMethod( string $fn, array & $apiparams )
Maps called PHP magic method name to Twitter API method |
protected
string
|
|
protected
string
|
#
_mapFnRestoreParamUnderscores( string $method )
API method mapping: Restore _ character in named parameters |
public
string
|
#
oauth_authenticate( optional $force_login = NULL, optional $screen_name = NULL, optional $type = 'authenticate' )
Gets the OAuth authenticate URL for the current request token |
public
string
|
#
oauth_authorize( optional $force_login = NULL, optional $screen_name = NULL )
Gets the OAuth authorize URL for the current request token |
public
string
|
|
protected
resource
|
|
protected
array
|
#
getNoCurlInitialization( string $url, array $contextOptions, string $hostname = '' )
Gets a non cURL initialization |
protected
|
|
protected
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
#
_parseBearerReply( string $result, integer $httpstatus )
Parse oauth2_token reply and set bearer token, if found |
protected
null|array
|
|
protected
|
#
_validateSslCertificate( integer $validation_result )
Check if there were any SSL certificate errors |
protected
mixed
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
string
|
|
protected
boolean
|
|
protected
string
|
#
_getMultipartRequestFromParams( string $method_template, string $border, array $params )
Merge multipart string from parameters array |
protected
mixed
|
|
protected
null|string
|
#
_buildMultipart( string $method, array $params )
Detect filenames in upload parameters, build multipart request from upload params |
protected
null|string
|
|
protected
mixed
|
|
protected
boolean
|
|
protected
boolean
|
|
protected
boolean
|
|
protected
string|false
|
#
_detectStreaming( string $method )
Detects if API call should use streaming endpoint, and if yes, which one |
protected
string
|
|
protected
string
|
|
protected
string
|
#
_callApiCurl( string $httpmethod, string $method, string $method_template, array $params = [], boolean $multipart = false, boolean $app_only_auth = false )
Calls the API using cURL |
protected
string
|
#
_callApiNoCurl( string $httpmethod, string $method, string $method_template, array $params = [], boolean $multipart = false, boolean $app_only_auth = false )
Calls the API without cURL |
protected
string[]
|
#
_callApiPreparationsGet( string $httpmethod, string $url, array $params, boolean $app_only_auth )
Do preparations to make the API GET call |
protected
array
|
#
_callApiPreparationsPost( string $httpmethod, string $url, string $method, string $method_template, array $params, boolean $multipart, boolean $app_only_auth )
Do preparations to make the API POST call |
protected
string
|
|
protected
array
|
#
_callApiPreparations( string $httpmethod, string $method, string $method_template, array $params, boolean $multipart, boolean $app_only_auth )
Do preparations to make the API call |
protected
|
#
_callApiStreaming( string $httpmethod, string $method, string $method_template, array $params = [], boolean $app_only_auth = false )
Calls the streaming API |
protected
boolean
|
#
_deliverStreamingMessage( string|array|object $message )
Calls streaming callback with received message |
protected
array
|
|
protected
string
|
#
_parseApiReplyPrefillHeaders( array $headers, string $reply )
Parses the API headers to return Location and Ton API headers |
protected
array|string|object
|
protected static
|
$_oauth_consumer_key
The OAuth consumer key of your registered app |
#
null
|
protected static
|
$_oauth_consumer_secret
The corresponding consumer secret |
#
null
|
protected static
|
$_oauth_bearer_token
The app-only bearer token. Used to authorize app-only requests |
#
null
|
protected static
string
|
$_endpoint
The API endpoint to use |
#
'https://api.twitter.com/1.1/'
|
protected static
string
|
$_endpoint_media
The media API endpoint to use |
#
'https://upload.twitter.com/1.1/'
|
protected static
array
|
$_endpoints_streaming
The Streaming API endpoints to use |
#
[
'public' => 'https://stream.twitter.com/1.1/',
'user' => 'https://userstream.twitter.com/1.1/',
'site' => 'https://sitestream.twitter.com/1.1/'
]
|
protected static
string
|
$_endpoint_ton
The TON API endpoint to use |
#
'https://ton.twitter.com/1.1/'
|
protected static
string
|
$_endpoint_ads
The Ads API endpoint to use |
#
'https://ads-api.twitter.com/0/'
|
protected static
string
|
$_endpoint_ads_sandbox
The Ads Sandbox API endpoint to use |
#
'https://ads-api-sandbox.twitter.com/0/'
|
protected static
string
|
$_endpoint_oauth
The API endpoint base to use |
#
'https://api.twitter.com/'
|
protected static
array
|
$_possible_files
Possible file name parameters |
#
[
// Tweets
'statuses/update_with_media' => ['media[]'],
'media/upload' => ['media'],
// Accounts
'account/update_profile_background_image' => ['image'],
'account/update_profile_image' => ['image'],
'account/update_profile_banner' => ['banner']
]
|
protected
|
$_oauth_token
The Request or access token. Used to sign requests |
#
null
|
protected
|
$_oauth_token_secret
The corresponding request or access token secret |
#
null
|
protected
|
$_return_format
The format of data to return from API calls |
#
CODEBIRD_RETURNFORMAT_OBJECT
|
protected
array
|
$_supported_media_files
The file formats that Twitter accepts as image uploads |
#
[
IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_BMP,
IMAGETYPE_GIF //, IMAGETYPE_WEBP
]
|
protected
|
$_streaming_callback
The callback to call with any new streaming messages |
#
null
|
protected
string
|
$_version
The current Codebird version |
#
'3.0.0-dev'
|
protected
boolean
|
$_use_curl
Auto-detect cURL absence |
#
true
|
protected
integer
|
$_timeout
Request timeout |
#
10000
|
protected
integer
|
$_connectionTimeout
Connection timeout |
#
3000
|
protected
integer
|
$_remoteDownloadTimeout
Remote media download timeout |
#
5000
|
protected
array
|
$_proxy
Proxy |
#
[]
|