Sina Weibo has an advanced interface 'statuses/upload_url_text '(You need to apply for an additional interface in open.weibo.com ).
After passing an image URL address and text content, you can send a text microblog
The function corresponding to the php SDK is as follows:
| The code is as follows: |
Copy code |
? /**
* Specify an image URL to capture and upload the image and publish a new microblog at the same time.
*
* Corresponds to the API: {@ link http://open.weibo.com/wiki/2/statuses/upload_url_text statuses/upload_url_text}
*
* @ Param string $ status refers to the content of Weibo text to be published. The content cannot exceed 140 Chinese characters.
* @ Param string $ url the URL of the image. It must start with http.
* @ Return array
*/
Function upload_url_text ($ status, $ url)
{
$ Params = array ();
$ Params ['status'] = $ status;
$ Params ['URL'] = $ url;
Return $ this-> oauth-> post ('statuses/upload', $ params, true );
}
|
An obvious error occurred while calling the api: $ this-> oauth-> post ('statuses/upload', $ params, true );
(On the one hand, the request should be statuses/upload_url_text, and on the other hand, the third parameter is incorrect)
As a result, the following error occurs: 20007 (20007: does multipart has image ?)
It will be OK if it is changed:
| The code is as follows: |
Copy code |
|
? /**
* Specify an image URL to capture and upload the image and publish a new microblog at the same time.
*
* Corresponds to the API: {@ link http://open.weibo.com/wiki/2/statuses/upload_url_text statuses/upload_url_text}
*
* @ Param string $ status refers to the content of Weibo text to be published. The content cannot exceed 140 Chinese characters.
* @ Param string $ url the URL of the image. It must start with http.
* @ Return array
*/
Function upload_url_text ($ status, $ url)
{
$ Params = array ();
$ Params ['status'] = $ status;
$ Params ['URL'] = $ url;
Return $ this-> oauth-> post ('statuses/upload_url_text ', $ params, false );
} |