@@ -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-
187166This is the [ resulting tweet] ( https://twitter.com/LarryMcTweet/status/482239971399835648 )
188167sent 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
210193to ``` statuses/update ``` , like this:
211194
@@ -221,10 +204,20 @@ $reply = $cb->statuses_update(array(
221204print_r($reply);
222205);
223206```
207+
224208Here is a [ sample tweet] ( https://twitter.com/LarryMcTweet/status/475276535386365952 )
225209sent 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
279272I suggest you to check if the ``` $reply->httpstatus ``` property is ``` 400 ```
280273and check with the Twitter API to find out if you are currently being
281274rate-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 )
283276for 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
286279in the returned data’s ``` $reply->rate ``` property,
287280if the Twitter API responds with rate-limiting HTTP headers.
288281
0 commit comments