@@ -2,7 +2,7 @@ codebird-php
22============
33* A Twitter library in PHP.*
44
5- Copyright (C) 2010-2014 Jublo Solutions & lt ; support@jublo.net & gt ;
5+ Copyright (C) 2010-2014 Jublo Solutions < support@jublo.net >
66
77This program is free software: you can redistribute it and/or modify
88it under the terms of the GNU General Public License as published by
@@ -17,20 +17,15 @@ GNU General Public License for more details.
1717You should have received a copy of the GNU General Public License
1818along with this program. If not, see < http://www.gnu.org/licenses/ > .
1919
20- ### Versions
21-
22- - JavaScript: https://github.com/jublonet/codebird-js
23- - PHP: https://github.com/jublonet/codebird-php
24-
2520### Requirements
2621
2722- PHP 5.3.0 or higher
2823- CURL extension
2924- OpenSSL extension
3025
3126
32- 1 . Authentication
33- -----------------
27+ Authentication
28+ --------------
3429
3530To authenticate your API requests on behalf of a certain Twitter user
3631(following OAuth 1.0a), take a look at these steps:
@@ -92,7 +87,7 @@ if (! isset($_SESSION['oauth_token'])) {
9287$cb->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
9388```
9489
95- ### 1.1. Application-only auth
90+ ### Application-only auth
9691
9792Some API methods also support authenticating on a per-application level.
9893This is useful for getting data that are not directly related to a specific
@@ -117,8 +112,8 @@ If you already have your token, tell Codebird to use it:
117112For sending an API request with app-only auth, see the ‘Usage examples’ section.
118113
119114
120- 2 . Usage examples
121- -----------------
115+ Usage examples
116+ --------------
122117
123118When you have an access token, calling the API is simple:
124119
@@ -206,8 +201,8 @@ $reply = $cb->search_tweets('q=Twitter', true);
206201
207202Bear in mind that not all API methods support application-only auth.
208203
209- 3 . Mapping API methods to Codebird function calls
210- -------------------------------------------------
204+ Mapping API methods to Codebird function calls
205+ ----------------------------------------------
211206
212207As you can see from the last example, there is a general way how Twitter’s API methods
213208map to Codebird function calls. The general rules are:
@@ -228,19 +223,19 @@ map to Codebird function calls. The general rules are:
228223 - ``` users/profile_image/:screen_name ``` maps to
229224 ``` Codebird::users_profileImage_SCREEN_NAME('screen_name=jublonet') ``` .
230225
231- 4 . HTTP methods (GET, POST, DELETE etc.)
232- ----------------------------------------
226+ HTTP methods (GET, POST, DELETE etc.)
227+ -------------------------------------
233228
234229Never care about which HTTP method (verb) to use when calling a Twitter API.
235230Codebird is intelligent enough to find out on its own.
236231
237- 5 . Response codes
238- -----------------
232+ Response codes
233+ --------------
239234
240235The HTTP response code that the API gave is included in any return values.
241236You can find it within the return object’s ``` httpstatus ``` property.
242237
243- ### 5.1 Dealing with rate-limits
238+ ### Dealing with rate-limits
244239
245240Basically, Codebird leaves it up to you to handle Twitter’s rate limit.
246241The library returns the response HTTP status code, so you can detect rate limits.
@@ -252,10 +247,11 @@ See the [Rate Limiting FAQ](https://dev.twitter.com/docs/rate-limiting-faq)
252247for more information.
253248
254249Unless your return format is JOSN, you will receive rate-limiting details
255- in the returned data’s ``` $reply->rate ``` property.
250+ in the returned data’s ``` $reply->rate ``` property,
251+ if the Twitter API responds with rate-limiting HTTP headers.
256252
257- 6 . Return formats
258- -----------------
253+ Return formats
254+ --------------
259255The default return format for API calls is a PHP object.
260256For API methods returning multiple data (like ``` statuses/home_timeline ``` ),
261257you should cast the reply to array, like this:
@@ -278,10 +274,8 @@ To get a JSON string, set the corresponding return format:
278274$cb->setReturnFormat(CODEBIRD_RETURNFORMAT_JSON);
279275```
280276
281- Support for getting a SimpleXML object is planned.
282-
283- 7 . Using multiple Codebird instances
284- ------------------------------------
277+ Using multiple Codebird instances
278+ ---------------------------------
285279
286280By default, Codebird works with just one instance. This programming paradigma is
287281called a * singleton* .
@@ -306,10 +300,9 @@ multiple Codebird instances, while the OAuth request and access tokens with thei
306300secrets are * not* shared.
307301
308302How Do I…?
309- ==========
303+ ----------
310304
311- …access a user’s profile image?
312- -------------------------------
305+ ### …access a user’s profile image?
313306
314307First retrieve the user object using
315308
@@ -325,8 +318,7 @@ For example:
325318
326319``` $reply['profile_image_url'] ``` will then return the profile image url without https.
327320
328- …get user ID, screen name and more details about the current user?
329- ------------------------------------------------------------------
321+ ### …get user ID, screen name and more details about the current user?
330322
331323When the user returns from the authentication screen, you need to trade
332324the obtained request token for an access token, using the OAuth verifier.
@@ -362,8 +354,7 @@ print_r($reply);
362354I suggest to cache the User Entity after obtaining it, as the
363355``` account/verify_credentials ``` method is rate-limited by 15 calls per 15 minutes.
364356
365- …walk through cursored results?
366- -------------------------------
357+ ### …walk through cursored results?
367358
368359The Twitter REST API utilizes a technique called ‘cursoring’ to paginate
369360large result sets. Cursoring separates results into pages of no more than
@@ -396,8 +387,7 @@ It might make sense to use the cursors in a loop. Watch out, though,
396387not to send more than the allowed number of requests to ``` followers/list ```
397388per rate-limit timeframe, or else you will hit your rate-limit.
398389
399- …use xAuth with Codebird?
400- -------------------------
390+ ### …use xAuth with Codebird?
401391
402392Codebird supports xAuth just like every other authentication used at Twitter.
403393Remember that your application needs to be whitelisted to be able to use xAuth.
@@ -432,8 +422,7 @@ When this error occurs, advise the user to
432422[ generate a temporary password] ( https://twitter.com/settings/applications )
433423on twitter.com and use that to complete signing in to the application.
434424
435- …know what cacert.pem is for?
436- -----------------------------
425+ ### …know what cacert.pem is for?
437426
438427Connections to the Twitter API are done over a secured SSL connection.
439428Since 2.4.0, codebird-php checks if the Twitter API server has a valid
@@ -442,8 +431,7 @@ The cacert.pem file contains a list of all public certificates for root
442431certificate authorities. You can find more information about this file
443432at http://curl.haxx.se/docs/caextract.html .
444433
445- …set the timeout for requests to the Twitter API?
446- -------------------------------------------------
434+ ### …set the timeout for requests to the Twitter API?
447435
448436For connecting to Twitter, Codebird uses the cURL library.
449437You can specify both the connection timeout and the request timeout,
0 commit comments