@@ -204,13 +204,13 @@ You can find it within the return object’s ```httpstatus``` property.
204
204
205
205
### 5.1 Dealing with rate-limits
206
206
207
- Basically, Codebird leaves it up to you to handle Twitter’s rate limit.
207
+ Basically, Codebird leaves it up to you to handle Twitter’s rate limit.
208
208
The library returns the response HTTP status code, so you can detect rate limits.
209
209
210
- I suggest you to check if the ``` $reply->httpstatus ``` property is ``` 400 ```
211
- and check with the Twitter API to find out if you are currently being
212
- rate-limited.
213
- See the [ Rate Limiting FAQ] ( https://dev.twitter.com/docs/rate-limiting-faq )
210
+ I suggest you to check if the ``` $reply->httpstatus ``` property is ``` 400 ```
211
+ and check with the Twitter API to find out if you are currently being
212
+ rate-limited.
213
+ See the [ Rate Limiting FAQ] ( https://dev.twitter.com/docs/rate-limiting-faq )
214
214
for more information.
215
215
216
216
6 . Return formats
@@ -277,7 +277,7 @@ First retrieve the user object using
277
277
278
278
with ``` $username ``` being the username of the account you wish to retrieve the profile image from.
279
279
280
- Then get the value from the index ``` profile_image_url ``` or ``` profile_image_url_https ``` of the user object previously retrieved.
280
+ Then get the value from the index ``` profile_image_url ``` or ``` profile_image_url_https ``` of the user object previously retrieved.
281
281
282
282
283
283
For example:
@@ -289,7 +289,7 @@ For example:
289
289
290
290
When the user returns from the authentication screen, you need to trade
291
291
the obtained request token for an access token, using the OAuth verifier.
292
- As discussed in the section ‘Usage example,’ you use a call to
292
+ As discussed in the section ‘Usage example,’ you use a call to
293
293
``` oauth/access_token ``` to do that.
294
294
295
295
The API reply to this method call tells you details about the user that just logged in.
@@ -305,29 +305,29 @@ stdClass Object
305
305
[user_id] => 14648265
306
306
[screen_name] => mynetx
307
307
[httpstatus] => 200
308
- )
308
+ )
309
309
```
310
310
311
- If you need to get more details, such as the user’s latest tweet,
312
- you should fetch the complete User Entity. The simplest way to get the
313
- user entity of the currently authenticated user is to use the
311
+ If you need to get more details, such as the user’s latest tweet,
312
+ you should fetch the complete User Entity. The simplest way to get the
313
+ user entity of the currently authenticated user is to use the
314
314
``` account/verify_credentials ``` API method. In Codebird, it works like this:
315
315
316
316
``` php
317
317
$reply = $cb->account_verifyCredentials();
318
318
print_r($reply);
319
319
```
320
320
321
- I suggest to cache the User Entity after obtaining it, as the
322
- ``` account/verify_credentials ``` method is rate-limited by 15 calls per 15 minutes.
321
+ I suggest to cache the User Entity after obtaining it, as the
322
+ ``` account/verify_credentials ``` method is rate-limited by 15 calls per 15 minutes.
323
323
324
324
…walk through cursored results?
325
325
-------------------------------
326
326
327
- The Twitter REST API utilizes a technique called ‘cursoring’ to paginate
328
- large result sets. Cursoring separates results into pages of no more than
329
- 5000 results at a time, and provides a means to move backwards and
330
- forwards through these pages.
327
+ The Twitter REST API utilizes a technique called ‘cursoring’ to paginate
328
+ large result sets. Cursoring separates results into pages of no more than
329
+ 5000 results at a time, and provides a means to move backwards and
330
+ forwards through these pages.
331
331
332
332
Here is how you can walk through cursored results with Codebird.
333
333
@@ -348,11 +348,11 @@ $nextCursor = $result1->next_cursor_str;
348
348
}
349
349
```
350
350
351
- To navigate back instead of forth, use the field ``` $resultX->previous_cursor_str ```
351
+ To navigate back instead of forth, use the field ``` $resultX->previous_cursor_str ```
352
352
instead of ``` next_cursor_str ``` .
353
353
354
- It might make sense to use the cursors in a loop. Watch out, though,
355
- not to send more than the allowed number of requests to ``` followers/list ```
354
+ It might make sense to use the cursors in a loop. Watch out, though,
355
+ not to send more than the allowed number of requests to ``` followers/list ```
356
356
per rate-limit timeframe, or else you will hit your rate-limit.
357
357
358
358
…use xAuth with Codebird?
@@ -370,9 +370,9 @@ $reply = $cb->oauth_accessToken(array(
370
370
));
371
371
```
372
372
373
- Are you getting a strange error message? If the user is enrolled in
374
- login verification, the server will return a HTTP 401 error with a custom body.
375
- If you are using the send_error_codes parameter, you will receive the
373
+ Are you getting a strange error message? If the user is enrolled in
374
+ login verification, the server will return a HTTP 401 error with a custom body.
375
+ If you are using the send_error_codes parameter, you will receive the
376
376
following error message in the response body:
377
377
378
378
``` xml
@@ -387,16 +387,28 @@ Otherwise, the response body will contain a plaintext response:
387
387
User must verify login
388
388
```
389
389
390
- When this error occurs, advise the user to
390
+ When this error occurs, advise the user to
391
391
[ generate a temporary password] ( https://twitter.com/settings/applications )
392
392
on twitter.com and use that to complete signing in to the application.
393
393
394
394
…know what cacert.pem is for?
395
395
-----------------------------
396
396
397
- Connections to the Twitter API are done over a secured SSL connection.
398
- Since 2.4.0, codebird-php checks if the Twitter API server has a valid
399
- SSL certificate. Valid certificates have a correct signature-chain.
400
- The cacert.pem file contains a list of all public certificates for root
401
- certificate authorities. You can find more information about this file
397
+ Connections to the Twitter API are done over a secured SSL connection.
398
+ Since 2.4.0, codebird-php checks if the Twitter API server has a valid
399
+ SSL certificate. Valid certificates have a correct signature-chain.
400
+ The cacert.pem file contains a list of all public certificates for root
401
+ certificate authorities. You can find more information about this file
402
402
at http://curl.haxx.se/docs/caextract.html .
403
+
404
+ …set the timeout for requests to the Twitter API?
405
+ -------------------------------------------------
406
+
407
+ For connecting to Twitter, Codebird uses the cURL library.
408
+ You can specify both the connection timeout and the request timeout,
409
+ in milliseconds:
410
+
411
+ ``` php
412
+ $cb->setConnectionTimeout(2000);
413
+ $cb->setTimeout(5000);
414
+ ```
0 commit comments