Home > Backend Development > PHP Tutorial > Sina Weibo PHP version SDK causes 20007 error_PHP tutorial

Sina Weibo PHP version SDK causes 20007 error_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:56:46
Original
1081 people have browsed it

This article is about reposting an article about the solution to the 20007 error caused by the Sina Weibo PHP version SDK. Friends who encounter such problems can refer to it.

Sina Weibo has an advanced interface ‘statuses/upload_url_text’ (requires additional application in open.weibo.com).

By passing an image URL address and text content, you can post a picture and text Weibo

The functions corresponding to the php version of SDK are as follows:

 代码如下 复制代码
?   /**
 * 指定一个图片URL地址抓取后上传并同时发布一条新微博
 *
 * 对应API:{@link http://open.weibo.com/wiki/2/statuses/upload_url_text statuses/upload_url_text}
 *
 * @param string $status  要发布的微博文本内容,内容不超过140个汉字。
 * @param string $url    图片的URL地址,必须以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 );
}

There is an obvious error in calling the api: $this->oauth->post( 'statuses/upload', $params, true );

(On the one hand, it should request: statuses/upload_url_text, on the other hand, the third parameter is wrong)

As a result: 20007 error (20007: does multipart has image?)

It will be ok if you change it to this:

The code is as follows
 代码如下 复制代码

?   /**
 * 指定一个图片URL地址抓取后上传并同时发布一条新微博
 *
 * 对应API:{@link http://open.weibo.com/wiki/2/statuses/upload_url_text statuses/upload_url_text}
 *
 * @param string $status  要发布的微博文本内容,内容不超过140个汉字。
 * @param string $url    图片的URL地址,必须以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);
}

Copy code
? /**
* Specify an image URL address to capture, upload and publish a new Weibo at the same time
*
* Corresponding API: {@link http://open.weibo.com/wiki/2/statuses/upload_url_text statuses/upload_url_text}
*
* @param string $status Weibo text content to be published, the content should not exceed 140 Chinese characters.
* @param string $url The URL address of the image 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);
}

http://www.bkjia.com/PHPjc/632141.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/632141.html
TechArticle
This article is about the solution to the 20007 error caused by the Sina Weibo PHP version SDK. I encountered this Friends who have similar problems can refer to it. Sina Weibo has an advanced interface statuses/upload_url_text (...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template