Sina Weibo has an advanced interface & amp; rsquo; statusesupload_url_text & amp; rsquo; (you need to apply for an additional interface in openweibocom) to transmit an image URL address and text content.
Sina Weibo has an advanced interface 'statuses/upload_url_text '(You need to apply for it 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:
- /**
- * 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, on the other hand, if the third parameter is incorrect, the following error occurs: 20007 (20007: does multipart has image ?)
It will be OK if it is changed:
- * 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 );
- }?>