8000 codebird-php/README.md at develop · pashachek/codebird-php · GitHub
[go: up one dir, main page]

Skip to content
< 8000 script type="application/json" data-target="react-app.embeddedData">{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"src","path":"src","contentType":"directory"},{"name":".gitattributes","path":".gitattributes","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"CHANGELOG","path":"CHANGELOG","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"bower.json","path":"bower.json","contentType":"file"},{"name":"composer.json","path":"composer.json","contentType":"file"},{"name":"phpunit.xml","path":"phpunit.xml","contentType":"file"}],"totalCount":10}},"fileTreeProcessingTime":10.348509,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":36012366,"defaultBranch":"develop","name":"codebird-php","ownerLogin":"pashachek","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2015-05-21T12:48:16.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/8099130?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"develop","listCacheKey":"v0:1619164315.4834712","canEdit":false,"refType":"branch","currentOid":"b05a061fc4b7fa91bb7ba19b53694b6870931d39"},"path":"README.md","currentUser":null,"blob":{"rawLines":null,"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/pashachek/codebird-php/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"README.md","displayUrl":"https://github.com/pashachek/codebird-php/blob/develop/README.md?raw=true","headerInfo":{"blobSize":"17.4 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"eec3f96","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fpashachek%2Fcodebird-php%2Fblob%2Fdevelop%2FREADME.md","isCSV":false,"isRichtext":true,"toc":[{"level":1,"text":"codebird-php","anchor":"codebird-php","htmlText":"codebird-php"},{"level":3,"text":"Requirements","anchor":"requirements","htmlText":"Requirements"},{"level":2,"text":"Summary","anchor":"summary","htmlText":"Summary"},{"level":2,"text":"Authentication","anchor":"authentication","htmlText":"Authentication"},{"level":3,"text":"Logging out","anchor":"logging-out","htmlText":"Logging out"},{"level":3,"text":"Application-only auth","anchor":"application-only-auth","htmlText":"Application-only auth"},{"level":2,"text":"Usage examples","anchor":"usage-examples","htmlText":"Usage examples"},{"level":3,"text":"Uploading media to Twitter","anchor":"uploading-media-to-twitter","htmlText":"Uploading media to Twitter"},{"level":4,"text":"Remote files","anchor":"remote-files","htmlText":"Remote files"},{"level":3,"text":"Requests with app-only auth","anchor":"requests-with-app-only-auth","htmlText":"Requests with app-only auth"},{"level":2,"text":"Mapping API methods to Codebird function calls","anchor":"mapping-api-methods-to-codebird-function-calls","htmlText":"Mapping API methods to Codebird function calls"},{"level":2,"text":"HTTP methods (GET, POST, DELETE etc.)","anchor":"http-methods-get-post-delete-etc","htmlText":"HTTP methods (GET, POST, DELETE etc.)"},{"level":2,"text":"Response codes","anchor":"response-codes","htmlText":"Response codes"},{"level":3,"text":"Dealing with rate-limits","anchor":"dealing-with-rate-limits","htmlText":"Dealing with rate-limits"},{"level":2,"text":"Return formats","anchor":"return-formats","htmlText":"Return formats"},{"level":2,"text":"Using multiple Codebird instances","anchor":"using-multiple-codebird-instances","htmlText":"Using multiple Codebird instances"},{"level":2,"text":"Consuming the Twitter Streaming API","anchor":"consuming-the-twitter-streaming-api","htmlText":"Consuming the Twitter Streaming API"},{"level":2,"text":"How Do I…?","anchor":"how-do-i","htmlText":"How Do I…?"},{"level":3,"text":"…access a user’s profile image?","anchor":"access-a-users-profile-image","htmlText":"…access a user’s profile image?"},{"level":3,"text":"…get user ID, screen name and more details about the current user?","anchor":"get-user-id-screen-name-and-more-details-about-the-current-user","htmlText":"…get user ID, screen name and more details about the current user?"},{"level":3,"text":"…walk through cursored results?","anchor":"walk-through-cursored-results","htmlText":"…walk through cursored results?"},{"level":3,"text":"…use xAuth with Codebird?","anchor":"use-xauth-with-codebird","htmlText":"…use xAuth with Codebird?"},{"level":3,"text":"…know what cacert.pem is for?","anchor":"know-what-cacertpem-is-for","htmlText":"…know what cacert.pem is for?"},{"level":3,"text":"…set the timeout for requests to the Twitter API?","anchor":"set-the-timeout-for-requests-to-the-twitter-api","htmlText":"…set the timeout for requests to the Twitter API?"},{"level":3,"text":"…disable cURL?","anchor":"disable-curl","htmlText":"…disable cURL?"},{"level":3,"text":"…use a proxy?","anchor":"use-a-proxy","htmlText":"…use a proxy?"}],"lineInfo":{"truncatedLoc":"587","truncatedSloc":"425"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Markdown","languageID":222,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/pashachek/codebird-php/blob/develop/README.md","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/pashachek/codebird-php/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/pashachek/codebird-php/raw/refs/heads/develop/README.md","renderImageOrRaw":false,"richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ecodebird-php\u003c/h1\u003e\u003ca id=\"user-content-codebird-php\" class=\"anchor\" aria-label=\"Permalink: codebird-php\" href=\"#codebird-php\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cem\u003eA Twitter library in PHP.\u003c/em\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCopyright (C) 2010-2015 Jublo Solutions \u003ca href=\"mailto:support@jublo.net\"\u003esupport@jublo.net\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eYou should have received a copy of the GNU General Public License\nalong with this program. If not, see \u003ca href=\"http://www.gnu.org/licenses/\" rel=\"nofollow\"\u003ehttp://www.gnu.org/licenses/\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRequirements\u003c/h3\u003e\u003ca id=\"user-content-requirements\" class=\"anchor\" aria-label=\"Permalink: Requirements\" href=\"#requirements\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePHP 5.4.0 or higher\u003c/li\u003e\n\u003cli\u003eOpenSSL extension\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSummary\u003c/h2\u003e\u003ca id=\"user-content-summary\" class=\"anchor\" aria-label=\"Permalink: Summary\" href=\"#summary\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eUse Codebird to connect to the Twitter REST \u003cstrong\u003eand Streaming API ✨\u003c/strong\u003e from your PHP code.\u003cbr\u003e\nCodebird supports full 3-way OAuth as well as application-only auth.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAuthentication\u003c/h2\u003e\u003ca id=\"user-content-authentication\" class=\"anchor\" aria-label=\"Permalink: Authentication\" href=\"#authentication\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo authenticate your API requests on behalf of a certain Twitter user\n(following OAuth 1.0a), take a look at these steps:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"require_once ('codebird.php');\n\\Codebird\\Codebird::setConsumerKey('YOURKEY', 'YOURSECRET'); // static, see 'Using multiple Codebird instances'\n\n$cb = \\Codebird\\Codebird::getInstance();\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003erequire_once\u003c/span\u003e (\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ecodebird.php\u003c/span\u003e'\u003c/span\u003e);\n\\\u003cspan class=\"pl-v\"\u003eCodebird\u003c/span\u003e\\Codebird::\u003cspan class=\"pl-en\"\u003esetConsumerKey\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eYOURKEY\u003c/span\u003e'\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eYOURSECRET\u003c/span\u003e'\u003c/span\u003e); \u003cspan class=\"pl-c\"\u003e// static, see 'Using multiple Codebird instances'\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e = \\\u003cspan class=\"pl-v\"\u003eCodebird\u003c/span\u003e\\Codebird::\u003cspan class=\"pl-en\"\u003egetInstance\u003c/span\u003e();\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eYou may either set the OAuth token and secret, if you already have them:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;setToken('YOURTOKEN', 'YOURTOKENSECRET');\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetToken\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eYOURTOKEN\u003c/span\u003e'\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eYOURTOKENSECRET\u003c/span\u003e'\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eOr you authenticate, like this:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"session_start();\n\nif (! isset($_SESSION['oauth_token'])) {\n // get the request token\n $reply = $cb-\u0026gt;oauth_requestToken([\n 'oauth_callback' =\u0026gt; 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']\n ]);\n\n // store the token\n $cb-\u0026gt;setToken($reply-\u0026gt;oauth_token, $reply-\u0026gt;oauth_token_secret);\n $_SESSION['oauth_token'] = $reply-\u0026gt;oauth_token;\n $_SESSION['oauth_token_secret'] = $reply-\u0026gt;oauth_token_secret;\n $_SESSION['oauth_verify'] = true;\n\n // redirect to auth website\n $auth_url = $cb-\u0026gt;oauth_authorize();\n header('Location: ' . $auth_url);\n die();\n\n} elseif (isset($_GET['oauth_verifier']) \u0026amp;\u0026amp; isset($_SESSION['oauth_verify'])) {\n // verify the token\n $cb-\u0026gt;setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);\n unset($_SESSION['oauth_verify']);\n\n // get the access token\n $reply = $cb-\u0026gt;oauth_accessToken([\n 'oauth_verifier' =\u0026gt; $_GET['oauth_verifier']\n ]);\n\n // store the token (which is different from the request token!)\n $_SESSION['oauth_token'] = $reply-\u0026gt;oauth_token;\n $_SESSION['oauth_token_secret'] = $reply-\u0026gt;oauth_token_secret;\n\n // send to same URL, without oauth GET parameters\n header('Location: ' . basename(__FILE__));\n die();\n}\n\n// assign access token on each page load\n$cb-\u0026gt;setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-en\"\u003esession_start\u003c/span\u003e();\n\n\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (! \u003cspan class=\"pl-en\"\u003eisset\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token\u003c/span\u003e'\u003c/span\u003e])) {\n \u003cspan class=\"pl-c\"\u003e// get the request token\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eoauth_requestToken\u003c/span\u003e([\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_callback\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ehttp://\u003c/span\u003e'\u003c/span\u003e . \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SERVER\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eHTTP_HOST\u003c/span\u003e'\u003c/span\u003e] . \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SERVER\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eREQUEST_URI\u003c/span\u003e'\u003c/span\u003e]\n ]);\n\n \u003cspan class=\"pl-c\"\u003e// store the token\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetToken\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003eoauth_token\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003eoauth_token_secret\u003c/span\u003e);\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token\u003c/span\u003e'\u003c/span\u003e] = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003eoauth_token\u003c/span\u003e;\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token_secret\u003c/span\u003e'\u003c/span\u003e] = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003eoauth_token_secret\u003c/span\u003e;\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_verify\u003c/span\u003e'\u003c/span\u003e] = \u003cspan class=\"pl-c1\"\u003etrue\u003c/span\u003e;\n\n \u003cspan class=\"pl-c\"\u003e// redirect to auth website\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eauth_url\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eoauth_authorize\u003c/span\u003e();\n \u003cspan class=\"pl-en\"\u003eheader\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eLocation: \u003c/span\u003e'\u003c/span\u003e . \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eauth_url\u003c/span\u003e);\n \u003cspan class=\"pl-en\"\u003edie\u003c/span\u003e();\n\n} \u003cspan class=\"pl-k\"\u003eelseif\u003c/span\u003e (\u003cspan class=\"pl-en\"\u003eisset\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_GET\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_verifier\u003c/span\u003e'\u003c/span\u003e]) \u0026amp;\u0026amp; \u003cspan class=\"pl-en\"\u003eisset\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_verify\u003c/span\u003e'\u003c/span\u003e])) {\n \u003cspan class=\"pl-c\"\u003e// verify the token\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetToken\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token\u003c/span\u003e'\u003c/span\u003e], \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token_secret\u003c/span\u003e'\u003c/span\u003e]);\n unset(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_verify\u003c/span\u003e'\u003c/span\u003e]);\n\n \u003cspan class=\"pl-c\"\u003e// get the access token\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eoauth_accessToken\u003c/span\u003e([\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_verifier\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_GET\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_verifier\u003c/span\u003e'\u003c/span\u003e]\n ]);\n\n \u003cspan class=\"pl-c\"\u003e// store the token (which is different from the request token!)\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token\u003c/span\u003e'\u003c/span\u003e] = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003eoauth_token\u003c/span\u003e;\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token_secret\u003c/span\u003e'\u003c/span\u003e] = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003eoauth_token_secret\u003c/span\u003e;\n\n \u003cspan class=\"pl-c\"\u003e// send to same URL, without oauth GET parameters\u003c/span\u003e\n \u003cspan class=\"pl-en\"\u003eheader\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eLocation: \u003c/span\u003e'\u003c/span\u003e . \u003cspan class=\"pl-en\"\u003ebasename\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e__FILE__\u003c/span\u003e));\n \u003cspan class=\"pl-en\"\u003edie\u003c/span\u003e();\n}\n\n\u003cspan class=\"pl-c\"\u003e// assign access token on each page load\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetToken\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token\u003c/span\u003e'\u003c/span\u003e], \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token_secret\u003c/span\u003e'\u003c/span\u003e]);\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLogging out\u003c/h3\u003e\u003ca id=\"user-content-logging-out\" class=\"anchor\" aria-label=\"Permalink: Logging out\" href=\"#logging-out\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn case you want to log out the current user (to log in a different user without\ncreating a new Codebird object), just call the \u003ccode\u003elogout()\u003c/code\u003e method.\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;logout();\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$cb-\u0026gt;logout();\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eApplication-only auth\u003c/h3\u003e\u003ca id=\"user-content-application-only-auth\" class=\"anchor\" aria-label=\"Permalink: Application-only auth\" href=\"#application-only-auth\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eSome API methods also support authenticating on a per-application level.\nThis is useful for getting data that are not directly related to a specific\nTwitter user, but generic to the Twitter ecosystem (such as \u003ccode\u003esearch/tweets\u003c/code\u003e).\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTo obtain an app-only bearer token, call the appropriate API:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$reply = $cb-\u0026gt;oauth2_token();\n$bearer_token = $reply-\u0026gt;access_token;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eoauth2_token\u003c/span\u003e();\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ebearer_token\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003eaccess_token\u003c/span\u003e;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eI strongly recommend that you store the obtained bearer token in your database.\nThere is no need to re-obtain the token with each page load, as it becomes invalid\nonly when you call the \u003ccode\u003eoauth2/invalidate_token\u003c/code\u003e method.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIf you already have your token, tell Codebird to use it:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"\\Codebird\\Codebird::setBearerToken('YOURBEARERTOKEN');\"\u003e\u003cpre\u003e\\\u003cspan class=\"pl-v\"\u003eCodebird\u003c/span\u003e\\Codebird::\u003cspan class=\"pl-en\"\u003esetBearerToken\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eYOURBEARERTOKEN\u003c/span\u003e'\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn this case, you don't need to set the consumer key and secret.\nFor sending an API request with app-only auth, see the ‘Usage examples’ section.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUsage examples\u003c/h2\u003e\u003ca id=\"user-content-usage-examples\" class=\"anchor\" aria-label=\"Permalink: Usage examples\" href=\"#usage-examples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWhen you have an access token, calling the API is simple:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); // see above\n\n$reply = (array) $cb-\u0026gt;statuses_homeTimeline();\nprint_r($reply);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetToken\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token\u003c/span\u003e'\u003c/span\u003e], \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e_SESSION\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eoauth_token_secret\u003c/span\u003e'\u003c/span\u003e]); \u003cspan class=\"pl-c\"\u003e// see above\u003c/span\u003e\n\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = (\u003cspan class=\"pl-smi\"\u003earray\u003c/span\u003e) \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003estatuses_homeTimeline\u003c/span\u003e();\n\u003cspan class=\"pl-en\"\u003eprint_r\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\ 8000 "auto\"\u003eTweeting is as easy as this:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$reply = $cb-\u0026gt;statuses_update('status=Whohoo, I just tweeted!');\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003estatuses_update\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003estatus=Whohoo, I just tweeted!\u003c/span\u003e'\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cg-emoji class=\"g-emoji\" alias=\"warning\"\u003e⚠️\u003c/g-emoji\u003e \u003cem\u003eMake sure to urlencode any parameter values that contain\nquery-reserved characters, like tweeting the \u003ccode\u003e\u0026amp;\u003c/code\u003e sign:\u003c/em\u003e\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$reply = $cb-\u0026gt;statuses_update('status=' . urlencode('Fish \u0026amp; chips'));\n// will result in this:\n$reply = $cb-\u0026gt;statuses_update('status=Fish+%26+chips');\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003estatuses_update\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003estatus=\u003c/span\u003e'\u003c/span\u003e . \u003cspan class=\"pl-en\"\u003eurlencode\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eFish \u0026amp; chips\u003c/span\u003e'\u003c/span\u003e));\n\u003cspan class=\"pl-c\"\u003e// will result in this:\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003estatuses_update\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003estatus=Fish+%26+chips\u003c/span\u003e'\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn most cases, giving all parameters in an array is easier,\nbecause no encoding is needed:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$params = [\n 'status' =\u0026gt; 'Fish \u0026amp; chips'\n];\n$reply = $cb-\u0026gt;statuses_update($params);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eparams\u003c/span\u003e = [\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003estatus\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eFish \u0026amp; chips\u003c/span\u003e'\u003c/span\u003e\n];\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003estatuses_update\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eparams\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$params = [\n 'status' =\u0026gt; 'I love London',\n 'lat' =\u0026gt; 51.5033,\n 'long' =\u0026gt; 0.1197\n];\n$reply = $cb-\u0026gt;statuses_update($params);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eparams\u003c/span\u003e = [\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003estatus\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eI love London\u003c/span\u003e'\u003c/span\u003e,\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003elat\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-c1\"\u003e51.5033\u003c/span\u003e,\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003elong\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-c1\"\u003e0.1197\u003c/span\u003e\n];\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003estatuses_update\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eparams\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$params = [\n 'screen_name' =\u0026gt; 'jublonet'\n];\n$reply = $cb-\u0026gt;users_show($params);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eparams\u003c/span\u003e = [\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003escreen_name\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ejublonet\u003c/span\u003e'\u003c/span\u003e\n];\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eusers_show\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eparams\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis is the \u003ca href=\"https://twitter.com/LarryMcTweet/status/482239971399835648\" rel=\"nofollow\"\u003eresulting tweet\u003c/a\u003e\nsent with the code above.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUploading media to Twitter\u003c/h3\u003e\u003ca id=\"user-content-uploading-media-to-twitter\" class=\"anchor\" aria-label=\"Permalink: Uploading media to Twitter\" href=\"#uploading-media-to-twitter\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTweet media can be uploaded in a 2-step process.\n\u003cstrong\u003eFirst\u003c/strong\u003e you send each image to Twitter, like this:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// these files to upload. You can also just upload 1 image!\n$media_files = [\n 'bird1.jpg', 'bird2.jpg', 'bird3.jpg'\n];\n// will hold the uploaded IDs\n$media_ids = [];\n\nforeach ($media_files as $file) {\n // upload all media files\n $reply = $cb-\u0026gt;media_upload([\n 'media' =\u0026gt; $file\n ]);\n // and collect their IDs\n $media_ids[] = $reply-\u0026gt;media_id_string;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e// these files to upload. You can also just upload 1 image!\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emedia_files\u003c/span\u003e = [\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ebird1.jpg\u003c/span\u003e'\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ebird2.jpg\u003c/span\u003e'\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ebird3.jpg\u003c/span\u003e'\u003c/span\u003e\n];\n\u003cspan class=\"pl-c\"\u003e// will hold the uploaded IDs\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emedia_ids\u003c/span\u003e = [];\n\n\u003cspan class=\"pl-k\"\u003eforeach\u003c/span\u003e (\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emedia_files\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eas\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003efile\u003c/span\u003e) {\n \u003cspan class=\"pl-c\"\u003e// upload all media files\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003emedia_upload\u003c/span\u003e([\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003emedia\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003efile\u003c/span\u003e\n ]);\n \u003cspan class=\"pl-c\"\u003e// and collect their IDs\u003c/span\u003e\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emedia_ids\u003c/span\u003e[] = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003emedia_id_string\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eSecond,\u003c/strong\u003e you attach the collected media ids for all images to your call\nto \u003ccode\u003estatuses/update\u003c/code\u003e, like this:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// convert media ids to string list\n$media_ids = implode(',', $media_ids);\n\n// send tweet with these medias\n$reply = $cb-\u0026gt;statuses_update([\n 'status' =\u0026gt; 'These are some of my relatives.',\n 'media_ids' =\u0026gt; $media_ids\n]);\nprint_r($reply);\n);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e// convert media ids to string list\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emedia_ids\u003c/span\u003e = \u003cspan class=\"pl-en\"\u003eimplode\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003e,\u003c/span\u003e'\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emedia_ids\u003c/span\u003e);\n\n\u003cspan class=\"pl-c\"\u003e// send tweet with these medias\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003estatuses_update\u003c/span\u003e([\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003estatus\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eThese are some of my relatives.\u003c/span\u003e'\u003c/span\u003e,\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003emedia_ids\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emedia_ids\u003c/span\u003e\n]);\n\u003cspan class=\"pl-en\"\u003eprint_r\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e);\n);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHere is a \u003ca href=\"https://twitter.com/LarryMcTweet/status/475276535386365952\" rel=\"nofollow\"\u003esample tweet\u003c/a\u003e\nsent with the code above.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eMore \u003ca href=\"https://dev.twitter.com/rest/public/uploading-media-multiple-photos\" rel=\"nofollow\"\u003edocumentation for tweeting with media\u003c/a\u003e is available on the Twitter Developer site.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRemote files\u003c/h4\u003e\u003ca id=\"user-content-remote-files\" class=\"anchor\" aria-label=\"Permalink: Remote files\" href=\"#remote-files\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eRemote files received from \u003ccode\u003ehttp\u003c/code\u003e and \u003ccode\u003ehttps\u003c/code\u003e servers are supported, too:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$reply = $cb-\u0026gt;media_upload([\n 'media' =\u0026gt; 'http://www.bing.com/az/hprichbg/rb/BilbaoGuggenheim_EN-US11232447099_1366x768.jpg'\n]);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003emedia_upload\u003c/span\u003e([\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003emedia\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ehttp://www.bing.com/az/hprichbg/rb/BilbaoGuggenheim_EN-US11232447099_1366x768.jpg\u003c/span\u003e'\u003c/span\u003e\n]);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003cg-emoji class=\"g-emoji\" alias=\"warning\"\u003e⚠️\u003c/g-emoji\u003e \u003cem\u003eURLs containing Unicode characters should be normalised. A sample normalisation function can be found at \u003ca href=\"http://stackoverflow.com/a/6059053/1816603\" rel=\"nofollow\"\u003ehttp://stackoverflow.com/a/6059053/1816603\u003c/a\u003e\u003c/em\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRequests with app-only auth\u003c/h3\u003e\u003ca id=\"user-content-requests-with-app-only-auth\" class=\"anchor\" aria-label=\"Permalink: Requests with app-only auth\" href=\"#requests-with-app-only-auth\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo send API requests without an access token for a user (app-only auth),\nadd a second parameter to your method call, like this:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$reply = $cb-\u0026gt;search_tweets('q=Twitter', true);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esearch_tweets\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eq=Twitter\u003c/span\u003e'\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003etrue\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBear in mind that not all API methods support application-only auth.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMapping API methods to Codebird function calls\u003c/h2\u003e\u003ca id=\"user-content-mapping-api-methods-to-codebird-function-calls\" class=\"anchor\" aria-label=\"Permalink: Mapping API methods to Codebird function calls\" href=\"#mapping-api-methods-to-codebird-function-calls\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAs you can see from the last example, there is a general way how Twitter’s API methods\nmap to Codebird function calls. The general rules are:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eFor each slash in a Twitter API method, use an underscore in the Codebird function.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eExample: \u003ccode\u003estatuses/update\u003c/code\u003e maps to \u003ccode\u003eCodebird::statuses_update()\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eFor each underscore in a Twitter API method, use camelCase in the Codebird function.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eExample: \u003ccode\u003estatuses/home_timeline\u003c/code\u003e maps to \u003ccode\u003eCodebird::statuses_homeTimeline()\u003c/code\u003e.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eFor each parameter template in method, use UPPERCASE in the Codebird function.\nAlso don’t forget to include the parameter in your parameter list.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eExamples:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003estatuses/show/:id\u003c/code\u003e maps to \u003ccode\u003eCodebird::statuses_show_ID('id=12345')\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eusers/profile_image/:screen_name\u003c/code\u003e maps to\n\u003ccode\u003eCodebird::users_profileImage_SCREEN_NAME('screen_name=jublonet')\u003c/code\u003e.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHTTP methods (GET, POST, DELETE etc.)\u003c/h2\u003e\u003ca id=\"user-content-http-methods-get-post-delete-etc\" class=\"anchor\" aria-label=\"Permalink: HTTP methods (GET, POST, DELETE etc.)\" href=\"#http-methods-get-post-delete-etc\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eNever care about which HTTP method (verb) to use when calling a Twitter API.\nCodebird is intelligent enough to find out on its own.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eResponse codes\u003c/h2\u003e\u003ca id=\"user-content-response-codes\" class=\"anchor\" aria-label=\"Permalink: Response codes\" href=\"#response-codes\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe HTTP response code that the API gave is included in any return values.\nYou can find it within the return object’s \u003ccode\u003ehttpstatus\u003c/code\u003e property.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDealing with rate-limits\u003c/h3\u003e\u003ca id=\"user-content-dealing-with-rate-limits\" class=\"anchor\" aria-label=\"Permalink: Dealing with rate-limits\" href=\"#dealing-with-rate-limits\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBasically, Codebird leaves it up to you to handle Twitter’s rate limit.\nThe library returns the response HTTP status code, so you can detect rate limits.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI suggest you to check if the \u003ccode\u003e$reply-\u0026gt;httpstatus\u003c/code\u003e property is \u003ccode\u003e400\u003c/code\u003e\nand check with the Twitter API to find out if you are currently being\nrate-limited.\nSee the \u003ca href=\"https://dev.twitter.com/rest/public/rate-limiting\" rel=\"nofollow\"\u003eRate Limiting FAQ\u003c/a\u003e\nfor more information.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eUnless your return format is JSON, you will receive rate-limiting details\nin the returned data’s \u003ccode\u003e$reply-\u0026gt;rate\u003c/code\u003e property,\nif the Twitter API responds with rate-limiting HTTP headers.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eReturn formats\u003c/h2\u003e\u003ca id=\"user-content-return-formats\" class=\"anchor\" aria-label=\"Permalink: Return formats\" href=\"#return-formats\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe default return format for API calls is a PHP object.\nFor API methods returning multiple data (like \u003ccode\u003estatuses/home_timeline\u003c/code\u003e),\nyou should cast the reply to array, like this:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$reply = $cb-\u0026gt;statuses_homeTimeline();\n$data = (array) $reply;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003estatuses_homeTimeline\u003c/span\u003e();\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003edata\u003c/span\u003e = (\u003cspan class=\"pl-smi\"\u003earray\u003c/span\u003e) \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eUpon your choice, you may also get PHP arrays directly:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;setReturnFormat(CODEBIRD_RETURNFORMAT_ARRAY);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetReturnFormat\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003eCODEBIRD_RETURNFORMAT_ARRAY\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe Twitter API natively responds to API calls in JSON (JS Object Notation).\nTo get a JSON string, set the corresponding return format:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;setReturnFormat(CODEBIRD_RETURNFORMAT_JSON);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetReturnFormat\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003eCODEBIRD_RETURNFORMAT_JSON\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUsing multiple Codebird instances\u003c/h2\u003e\u003ca id=\"user-content-using-multiple-codebird-instances\" class=\"anchor\" aria-label=\"Permalink: Using multiple Codebird instances\" href=\"#using-multiple-codebird-instances\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBy default, Codebird works with just one instance. This programming paradigma is\ncalled a \u003cem\u003esingleton\u003c/em\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eGetting the main Codebird object is done like this:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb = \\Codebird\\Codebird::getInstance();\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e = \\\u003cspan class=\"pl-v\"\u003eCodebird\u003c/span\u003e\\Codebird::\u003cspan class=\"pl-en\"\u003egetInstance\u003c/span\u003e();\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you need to run requests to the Twitter API for multiple users at once,\nCodebird supports this as well. Instead of getting the instance like shown above,\ncreate a new object:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb1 = new \\Codebird\\Codebird;\n$cb2 = new \\Codebird\\Codebird;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb1\u003c/span\u003e = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \\\u003cspan class=\"pl-v\"\u003eCodebird\u003c/span\u003e\\\u003cspan class=\"pl-v\"\u003eCodebird\u003c/span\u003e;\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb2\u003c/span\u003e = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \\\u003cspan class=\"pl-v\"\u003eCodebird\u003c/span\u003e\\\u003cspan class=\"pl-v\"\u003eCodebird\u003c/span\u003e;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003ePlease note that your OAuth consumer key and secret is shared within\nmultiple Codebird instances, while the OAuth request and access tokens with their\nsecrets are \u003cem\u003enot\u003c/em\u003e shared.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConsuming the Twitter Streaming API\u003c/h2\u003e\u003ca id=\"user-content-consuming-the-twitter-streaming-api\" class=\"anchor\" aria-label=\"Permalink: Consuming the Twitter Streaming API\" href=\"#consuming-the-twitter-streaming-api\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe Streaming APIs give developers low latency access to Twitter’s global stream of\nTweet data. A proper implementation of a streaming client will be pushed messages\nindicating Tweets and other events have occurred, without any of the overhead\nassociated with polling a REST endpoin AB77 t.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTo consume one of the available Twitter streams, follow these \u003cstrong\u003etwo steps:\u003c/strong\u003e\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eSet up a callback function that gets called for every new streaming message that arrives.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCodebird also calls this function once per second, to allow you to work on any due tasks, and to give you the chance to cancel the stream even if no new messages appear.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eAfter creating the callback, tell Codebird about it using a \u003ca href=\"http://php.net/manual/en/language.types.callable.php\" rel=\"nofollow\"\u003ecallable\u003c/a\u003e. Then start consuming the stream.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// First, create a callback function:\n\nfunction some_callback($message)\n{\n // gets called for every new streamed message\n // gets called with $message = NULL once per second\n\n if ($message !== null) {\n print_r($message);\n flush();\n }\n\n // return false to continue streaming\n // return true to close the stream\n\n // close streaming after 1 minute for this simple sample\n // don't rely on globals in your code!\n if (time() - $GLOBALS['time_start'] \u0026gt;= 60) {\n return true;\n }\n\n return false;\n}\n\n// set the streaming callback in Codebird\n$cb-\u0026gt;setStreamingCallback('some_callback');\n\n// any callable is accepted:\n// $cb-\u0026gt;setStreamingCallback(['MyClass', 'some_callback']);\n\n// for canceling, see callback function body\n// not considered good practice in real world!\n$GLOBALS['time_start'] = time();\n\n// Second, start consuming the stream:\n$reply = $cb-\u0026gt;user();\n\n// See the *Mapping API methods to Codebird function calls* section for method names.\n// $reply = $cb-\u0026gt;statuses_filter('track=Windows');\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e// First, create a callback function:\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003efunction\u003c/span\u003e \u003cspan class=\"pl-en\"\u003esome_callback\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emessage\u003c/span\u003e)\n{\n \u003cspan class=\"pl-c\"\u003e// gets called for every new streamed message\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e// gets called with $message = NULL once per second\u003c/span\u003e\n\n \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emessage\u003c/span\u003e !== \u003cspan class=\"pl-c1\"\u003enull\u003c/span\u003e) {\n \u003cspan class=\"pl-en\"\u003eprint_r\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003emessage\u003c/span\u003e);\n \u003cspan class=\"pl-en\"\u003eflush\u003c/span\u003e();\n }\n\n \u003cspan class=\"pl-c\"\u003e// return false to continue streaming\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e// return true to close the stream\u003c/span\u003e\n\n \u003cspan class=\"pl-c\"\u003e// close streaming after 1 minute for this simple sample\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e// don't rely on globals in your code!\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-en\"\u003etime\u003c/span\u003e() - \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eGLOBALS\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003etime_start\u003c/span\u003e'\u003c/span\u003e] \u0026gt;= \u003cspan class=\"pl-c1\"\u003e60\u003c/span\u003e) {\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003etrue\u003c/span\u003e;\n }\n\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efalse\u003c/span\u003e;\n}\n\n\u003cspan class=\"pl-c\"\u003e// set the streaming callback in Codebird\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetStreamingCallback\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003esome_callback\u003c/span\u003e'\u003c/span\u003e);\n\n\u003cspan class=\"pl-c\"\u003e// any callable is accepted:\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e// $cb-\u0026gt;setStreamingCallback(['MyClass', 'some_callback']);\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e// for canceling, see callback function body\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e// not considered good practice in real world!\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eGLOBALS\u003c/span\u003e\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003etime_start\u003c/span\u003e'\u003c/span\u003e] = \u003cspan class=\"pl-en\"\u003etime\u003c/span\u003e();\n\n\u003cspan class=\"pl-c\"\u003e// Second, start consuming the stream:\u003c/span\u003e\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003euser\u003c/span\u003e();\n\n\u003cspan class=\"pl-c\"\u003e// See the *Mapping API methods to Codebird function calls* section for method names.\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e// $reply = $cb-\u0026gt;statuses_filter('track=Windows');\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFind more information on the \u003ca href=\"https://dev.twitter.com/streaming/overview\" rel=\"nofollow\"\u003eStreaming API\u003c/a\u003e\nin the developer documentation website.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHow Do I…?\u003c/h2\u003e\u003ca id=\"user-content-how-do-i\" class=\"anchor\" aria-label=\"Permalink: How Do I…?\" href=\"#how-do-i\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e…access a user’s profile image?\u003c/h3\u003e\u003ca id=\"user-content-access-a-users-profile-image\" class=\"anchor\" aria-label=\"Permalink: …access a user’s profile image?\" href=\"#access-a-users-profile-image\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFirst retrieve the user object using\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003e$reply = $cb-\u0026gt;users_show(\"screen_name=$username\");\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003ewith \u003ccode\u003e$username\u003c/code\u003e being the username of the account you wish to retrieve the profile image from.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThen get the value from the index \u003ccode\u003eprofile_image_url\u003c/code\u003e or \u003ccode\u003eprofile_image_url_https\u003c/code\u003e of the user object previously retrieved.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFor example:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003e$reply['profile_image_url']\u003c/code\u003e will then return the profile image url without https.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e…get user ID, screen name and more details about the current user?\u003c/h3\u003e\u003ca id=\"user-content-get-user-id-screen-name-and-more-details-about-the-current-user\" class=\"anchor\" aria-label=\"Permalink: …get user ID, screen name and more details about the current user?\" href=\"#get-user-id-screen-name-and-more-details-about-the-current-user\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWhen the user returns from the authentication screen, you need to trade\nthe obtained request token for an access token, using the OAuth verifier.\nAs discussed in the section ‘Usage example,’ you use a call to\n\u003ccode\u003eoauth/access_token\u003c/code\u003e to do that.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe API reply to this method call tells you details about the user that just logged in.\nThese details contain the \u003cstrong\u003euser ID\u003c/strong\u003e and the \u003cstrong\u003escreen name.\u003c/strong\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTake a look at the returned data as follows:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"stdClass Object\n(\n [oauth_token] =\u0026gt; 14648265-rPn8EJwfB**********************\n [oauth_token_secret] =\u0026gt; agvf3L3**************************\n [user_id] =\u0026gt; 14648265\n [screen_name] =\u0026gt; jublonet\n [httpstatus] =\u0026gt; 200\n)\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003estdClass Object\n(\n [oauth_token] =\u0026gt; 14648265-rPn8EJwfB**********************\n [oauth_token_secret] =\u0026gt; agvf3L3**************************\n [user_id] =\u0026gt; 14648265\n [screen_name] =\u0026gt; jublonet\n [httpstatus] =\u0026gt; 200\n)\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you need to get more details, such as the user’s latest tweet,\nyou should fetch the complete User Entity. The simplest way to get the\nuser entity of the currently authenticated user is to use the\n\u003ccode\u003eaccount/verify_credentials\u003c/code\u003e API method. In Codebird, it works like this:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$reply = $cb-\u0026gt;account_verifyCredentials();\nprint_r($reply);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eaccount_verifyCredentials\u003c/span\u003e();\n\u003cspan class=\"pl-en\"\u003eprint_r\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eI suggest to cache the User Entity after obtaining it, as the\n\u003ccode\u003eaccount/verify_credentials\u003c/code\u003e method is rate-limited by 15 calls per 15 minutes.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e…walk through cursored results?\u003c/h3\u003e\u003ca id=\"user-content-walk-through-cursored-results\" class=\"anchor\" aria-label=\"Permalink: …walk through cursored results?\" href=\"#walk-through-cursored-results\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe Twitter REST API utilizes a technique called ‘cursoring’ to paginate\nlarge result sets. Cursoring separates results into pages of no more than\n5000 results at a time, and provides a means to move backwards and\nforwards through these pages.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eHere is how you can walk through cursored results with Codebird.\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eGet the first result set of a cursored method:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$result1 = $cb-\u0026gt;followers_list();\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eresult1\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003efollowers_list\u003c/span\u003e();\u003c/pre\u003e\u003c/div\u003e\n\u003col start=\"2\" dir=\"auto\"\u003e\n\u003cli\u003eTo navigate forth, take the \u003ccode\u003enext_cursor_str\u003c/code\u003e:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$nextCursor = $result1-\u0026gt;next_cursor_str;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003enextCursor\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eresult1\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-c1\"\u003enext_cursor_str\u003c/span\u003e;\u003c/pre\u003e\u003c/div\u003e\n\u003col start=\"3\" dir=\"auto\"\u003e\n\u003cli\u003eIf \u003ccode\u003e$nextCursor\u003c/code\u003e is not 0, use this cursor to request the next result page:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\" if ($nextCursor \u0026gt; 0) {\n $result2 = $cb-\u0026gt;followers_list('cursor=' . $nextCursor);\n }\"\u003e\u003cpre\u003e \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003enextCursor\u003c/span\u003e \u0026gt; \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e) {\n \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003eresult2\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003efollowers_list\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ecursor=\u003c/span\u003e'\u003c/span\u003e . \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003enextCursor\u003c/span\u003e);\n }\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTo navigate back instead of forth, use the field \u003ccode\u003e$resultX-\u0026gt;previous_cursor_str\u003c/code\u003e\ninstead of \u003ccode\u003enext_cursor_str\u003c/code\u003e.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIt might make sense to use the cursors in a loop. Watch out, though,\nnot to send more than the allowed number of requests to \u003ccode\u003efollowers/list\u003c/code\u003e\nper rate-limit timeframe, or else you will hit your rate-limit.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e…use xAuth with Codebird?\u003c/h3\u003e\u003ca id=\"user-content-use-xauth-with-codebird\" class=\"anchor\" aria-label=\"Permalink: …use xAuth with Codebird?\" href=\"#use-xauth-with-codebird\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eCodebird supports xAuth just like every other authentication used at Twitter.\nRemember that your application needs to be whitelisted to be able to use xAuth.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eHere’s an example:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$reply = $cb-\u0026gt;oauth_accessToken([\n 'x_auth_username' =\u0026gt; 'username',\n 'x_auth_password' =\u0026gt; '4h3_p4$$w0rd',\n 'x_auth_mode' =\u0026gt; 'client_auth'\n]);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ereply\u003c/span\u003e = \u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003eoauth_accessToken\u003c/span\u003e([\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ex_auth_username\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eusername\u003c/span\u003e'\u003c/span\u003e,\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ex_auth_password\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003e4h3_p4$$w0rd\u003c/span\u003e'\u003c/span\u003e,\n \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003ex_auth_mode\u003c/span\u003e'\u003c/span\u003e =\u0026gt; \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003eclient_auth\u003c/span\u003e'\u003c/span\u003e\n]);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAre you getting a strange error message? If the user is enrolled in\nlogin verification, the server will return a HTTP 401 error with a custom body.\nIf you are using the \u003ccode\u003esend_error_codes\u003c/code\u003e parameter, you will receive the\nfollowing error message in the response body:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-xml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"\u0026lt;?xml version=\u0026quot;1.0\u0026quot; encoding=\u0026quot;UTF-8\u0026quot;?\u0026gt;\n\u0026lt;errors\u0026gt;\n\u0026lt;error code=\u0026quot;231\u0026quot;\u0026gt;User must verify login\u0026lt;/error\u0026gt;\n\u0026lt;/errors\u0026gt;\"\u003e\u003cpre\u003e\u0026lt;?\u003cspan class=\"pl-ent\"\u003exml\u003c/span\u003e\u003cspan class=\"pl-e\"\u003e version\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e1.0\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"pl-e\"\u003e encoding\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eUTF-8\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e?\u0026gt;\n\u0026lt;\u003cspan class=\"pl-ent\"\u003eerrors\u003c/span\u003e\u0026gt;\n\u0026lt;\u003cspan class=\"pl-ent\"\u003eerror\u003c/span\u003e \u003cspan class=\"pl-e\"\u003ecode\u003c/span\u003e=\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e231\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\u0026gt;User must verify login\u0026lt;/\u003cspan class=\"pl-ent\"\u003eerror\u003c/span\u003e\u0026gt;\n\u0026lt;/\u003cspan class=\"pl-ent\"\u003eerrors\u003c/span\u003e\u0026gt;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eOtherwise, the response body will contain a plaintext response:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"User must verify login\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eUser must verify login\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWhen this error occurs, advise the user to\n\u003ca href=\"https://twitter.com/settings/applications\" rel=\"nofollow\"\u003egenerate a temporary password\u003c/a\u003e\non twitter.com and use that to complete signing in to the application.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e…know what cacert.pem is for?\u003c/h3\u003e\u003ca id=\"user-content-know-what-cacertpem-is-for\" class=\"anchor\" aria-label=\"Permalink: …know what cacert.pem is for?\" href=\"#know-what-cacertpem-is-for\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eConnections to the Twitter API are done over a secured SSL connection.\nSince 2.4.0, codebird-php checks if the Twitter API server has a valid\nSSL certificate. Valid certificates have a correct signature-chain.\nThe cacert.pem file contains a list of all public certificates for root\ncertificate authorities. You can find more information about this file\nat \u003ca href=\"http://curl.haxx.se/docs/caextract.html\" rel=\"nofollow\"\u003ehttp://curl.haxx.se/docs/caextract.html\u003c/a\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e…set the timeout for requests to the Twitter API?\u003c/h3\u003e\u003ca id=\"user-content-set-the-timeout-for-requests-to-the-twitter-api\" class=\"anchor\" aria-label=\"Permalink: …set the timeout for requests to the Twitter API?\" href=\"#set-the-timeout-for-requests-to-the-twitter-api\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor connecting to Twitter, Codebird uses the cURL library, if available.\nYou can specify both the connection timeout and the request timeout,\nin milliseconds:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;setConnectionTimeout(2000);\n$cb-\u0026gt;setTimeout(5000);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetConnectionTimeout\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e2000\u003c/span\u003e);\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetTimeout\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e5000\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf you don't specify the timeout, codebird uses these values:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003econnection time = 3000 ms = 3 s\u003c/li\u003e\n\u003cli\u003etimeout = 10000 ms = 10 s\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e…disable cURL?\u003c/h3\u003e\u003ca id=\"user-content-disable-curl\" class=\"anchor\" aria-label=\"Permalink: …disable cURL?\" href=\"#disable-curl\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eCodebird automatically detects whether you have the PHP cURL extension enabled.\nIf not, the library will try to connect to Twitter via socket.\nFor this to work, the PHP setting \u003ccode\u003eallow_url_fopen\u003c/code\u003e must be enabled.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eYou may also manually disable cURL. Use the following call:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;setUseCurl(false);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetUseCurl\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003efalse\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e…use a proxy?\u003c/h3\u003e\u003ca id=\"user-content-use-a-proxy\" class=\"anchor\" aria-label=\"Permalink: …use a proxy?\" href=\"#use-a-proxy\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eCodebird allows proxy support for both cURL handles and sockets.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTo activate proxy mode, use the following call:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;setProxy('\u0026lt;host\u0026gt;', '\u0026lt;port\u0026gt;');\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetProxy\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003e\u0026lt;host\u0026gt;\u003c/span\u003e'\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003e\u0026lt;port\u0026gt;\u003c/span\u003e'\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eYou may also use an authenticated proxy. Use the following call:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-text-html-php notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"$cb-\u0026gt;setProxy('\u0026lt;host\u0026gt;', '\u0026lt;port\u0026gt;');\n$cb-\u0026gt;setProxyAuthentication('\u0026lt;username\u0026gt;:\u0026lt;password\u0026gt;');\"\u003e\u003cpre\u003e\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetProxy\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003e\u0026lt;host\u0026gt;\u003c/span\u003e'\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003e\u0026lt;port\u0026gt;\u003c/span\u003e'\u003c/span\u003e);\n\u003cspan class=\"pl-s1\"\u003e\u003cspan class=\"pl-c1\"\u003e$\u003c/span\u003ecb\u003c/span\u003e-\u0026gt;\u003cspan class=\"pl-en\"\u003esetProxyAuthentication\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'\u003cspan class=\"pl-s\"\u003e\u0026lt;username\u0026gt;:\u0026lt;password\u0026gt;\u003c/span\u003e'\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003c/article\u003e","renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/pashachek/codebird-php/branches":{"post":"L8M8kUpJuns-eJaK8z1seTBmHZYc5TKHycHwPFuGVpQ1JeuNI4eaXGrMzUQjgxOIjVfjwa6m2em6-aoz-e--9g"},"/repos/preferences":{"post":"1pChGMRsRwpf8aV4KV3WVwLG1EkxpEvcGSKA2XW5vGDGvP4aSFJbYOcPFlzyRUoMX-M2dib3K9GJPk4WRAGXFg"}}},"title":"codebird-php/README.md at develop · pashachek/codebird-php","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1b17b3e7786a.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0