20007 error caused by Sina Weibo php sdk _ PHP Tutorial

Source: Internet
Author: User
Tags oauth
The php sdk of Sina Weibo caused 20007 errors. This article describes how to solve the 20007 error caused by Sina Weibo php sdk. if you encounter such problems, refer. Sina Weibo has an advanced interface statusesupload_url_text (this article will refer to the solution to 20007 errors caused by the php sdk of Sina Weibo. if you encounter such problems, refer.

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:
? /**
* 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:

? /**
* 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 );
}

Bytes. Sina Weibo has an advanced interface statuses/upload_url_text (...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.