新浪微博有个高级接口’statuses/upload_url_text’(需要在open.weibo.com中额外申请),传递一个图片URL地址和文本内容,就可以发一条图文微博,对应在php版SDK的function如下:
- <?php
-
-
-
-
-
-
-
-
-
- function upload_url_text( $status, $url )
- {
- $params = array();
- $params['status'] = $status;
- $params['url'] = $url;
- return $this->oauth->post( 'statuses/upload', $params, true );
- }
- ?>
调用api的处有明显的错误:$this->oauth->post( 'statuses/upload', $params, true );(一方面应该请求:statuses/upload_url_text,另外一方面第三个参数错误)以致会出现:20007错误(20007:does multipart has image ?)
改成这样就ok了:
- <?php
-
-
-
-
-
-
-
-
- function upload_url_text( $status, $url )
- {
- $params = array();
- $params['status'] = $status;
- $params['url'] = $url;
- return $this->oauth->post( 'statuses/upload_url_text', $params, false);
- } ?>
|