8000 Finish 2.6.0 · redaxeprogrammers/codebird-php@8c6299b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c6299b

Browse files
committed
Finish 2.6.0
2 parents f74af47 + 08e59dd commit 8c6299b

File tree

4 files changed

+26
-32
lines changed

4 files changed

+26
-32
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ codebird-php - changelog
99
+ #66 Allow remote media uploads
1010
- #81 CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS errors on PHP 5.3
1111
- #83 Use POST for users/lookup and statuses/lookup, params may get too long for GET
12+
+ Update README to reflect new process for uploading single/multiple media, see #78
1213

1314
2.5.0 (2014-06-20)
1415
+ Add section about cacert.pem to README

README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -163,36 +163,18 @@ $params = array(
163163
);
164164
$reply = $cb->users_show($params);
165165
```
166-
167-
### Uploading files to Twitter
168-
169-
The array syntax is obligatory:
170-
171-
```php
172-
$params = array(
173-
'status' => 'Look at this crazy cat! #lolcats',
174-
'media[]' => '/home/jublonet/lolcats.jpg'
175-
);
176-
$reply = $cb->statuses_updateWithMedia($params);
177-
```
178-
179-
Remote files received from `http` and `https` servers are supported, too:
180-
```php
181-
$reply = $cb->statuses_updateWithMedia(array(
182-
'status' => 'This is the Guggenheim museum in Bilbao, Spain, as seen by @Bing.',
183-
'media[]' => 'http://www.bing.com/az/hprichbg/rb/BilbaoGuggenheim_EN-US11232447099_1366x768.jpg'
184-
));
185-
```
186-
187166
This is the [resulting tweet](https://twitter.com/LarryMcTweet/status/482239971399835648)
188167
sent with the code above.
189168

190-
#### Multiple images
191-
can be uploaded in a 2-step process. **First** you send each image to Twitter, like this:
169+
### Uploading media to Twitter
170+
171+
Tweet media can be uploaded in a 2-step process.
172+
**First** you send each image to Twitter, like this:
173+
192174
```php
193-
// these files to upload
175+
// these files to upload. You can also just upload 1 image!
194176
$media_files = array(
195-
'bird1.jpg', 'bird2.jpg', 'bird3.jpg' // http/https URLs allowed here, too!
177+
'bird1.jpg', 'bird2.jpg', 'bird3.jpg'
196178
);
197179
// will hold the uploaded IDs
198180
$media_ids = array();
@@ -206,6 +188,7 @@ foreach ($media_files as $file) {
206188
$media_ids[] = $reply->media_id_string;
207189
}
208190
```
191+
209192
**Second,** you attach the collected media ids for all images to your call
210193
to ```statuses/update```, like this:
211194

@@ -221,10 +204,20 @@ $reply = $cb->statuses_update(array(
221204
print_r($reply);
222205
);
223206
```
207+
224208
Here is a [sample tweet](https://twitter.com/LarryMcTweet/status/475276535386365952)
225209
sent with the code above.
226210

227-
More [documentation for tweeting with multiple media](https://dev.twitter.com/docs/api/multiple-media-extended-entities) is available on the Twitter Developer site.
211+
More [documentation for tweeting with media](https://dev.twitter.com/rest/public/uploading-media-multiple-photos) is available on the Twitter Developer site.
212+
213+
#### Remote files
214+
215+
Remote files received from `http` and `https` servers are supported, too:
216+
```php
217+
$reply = $cb->media_upload(array(
218+
'media' => 'http://www.bing.com/az/hprichbg/rb/BilbaoGuggenheim_EN-US11232447099_1366x768.jpg'
219+
));
220+
```
228221

229222
### Requests with app-only auth
230223

@@ -279,10 +272,10 @@ The library returns the response HTTP status code, so you can detect rate limits
279272
I suggest you to check if the ```$reply->httpstatus``` property is ```400```
280273
and check with the Twitter API to find out if you are currently being
281274
rate-limited.
282-
See the [Rate Limiting FAQ](https://dev.twitter.com/docs/rate-limiting-faq)
275+
See the [Rate Limiting FAQ](https://dev.twitter.com/rest/public/rate-limiting)
283276
for more information.
284277

285-
Unless your return format is JOSN, you will receive rate-limiting details
278+
Unless your return format is JSON, you will receive rate-limiting details
286279
in the returned data’s ```$reply->rate``` property,
287280
if the Twitter API responds with rate-limiting HTTP headers.
288281

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codebird-php",
3-
"version": "2.6.0-dev",
3+
"version": "2.6.0",
44
"homepage": "http://www.jublo.net/projects/codebird/php",
55
"authors": [
66
"Joshua Atkins <joshua.atkins@jublo.net>",

src/codebird.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* A Twitter library in PHP.
77
*
88
* @package codebird
9-
* @version 2.6.0-dev
9+
* @version 2.6.0
1010
* @author Jublo Solutions <support@jublo.net>
1111
* @copyright 2010-2014 Jublo Solutions <support@jublo.net>
1212
* @license http://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
@@ -109,7 +109,7 @@ class Codebird
109109
/**
110110
* The current Codebird version
111111
*/
112-
protected $_version = '2.6.0-dev';
112+
protected $_version = '2.6.0';
113113

114114
/**
115115
* Auto-detect cURL absence
@@ -390,7 +390,7 @@ public function getApiMethods()
390390
'statuses/lookup',
391391
'statuses/retweet/:id',
392392
'statuses/update',
393-
'statuses/update_with_media',
393+
'statuses/update_with_media', // deprecated, use media/upload
394394
'users/lookup',
395395
'users/report_spam',
396396

0 commit comments

Comments
 (0)
0