After a preliminary grasp of the development of the micro-blog application process, it is recommended to read through the code in weibooauth.php, priority reading the definition of public methods in class Weiboclient. These methods are directly to operate the microblogging and users, clear what the method, its calling interface, default parameters, and so on.
This article provides a description of the public method in class Weiboclient. These methods are used to directly manipulate microblogs and users, and need to be used skillfully to familiarize themselves with the name, parameters, and return value types of each method. The return value of most functions is array, and information about each field in the array is also required through the API documentation.
/**
* Publish Photo Weibo
* @access Public
* @param string $text to update the microblogging information.
* @param string $text The path of the picture to be published, supporting the URL. [Only support Png/jpg/gif three formats, add formatting please modify Get_image_mime method]
* @return Array
*/
function upload ($text, $pic _path)
Accordingly, we know that the code to send a picture microblog should include:
(1) Create an object instance of the Weiboclient class (this instance comes from authorization, a program in which multiple functions can share an instance);
(2) Preparation of micro-blog information and picture URL;
(3) Sending by upload method;
(4) Using the returned array to complete the follow-up processing.
<?php
$c = new Weiboclient (Wb_akey,
Wb_skey,
$_session[' Last_key ' [' Oauth_token '],
$_session[' Last_key ' [' Oauth_token_secret ']);
$t = ' new microblog ';
$p = ';
$RR = $c->upload ($t, $p);
echo "<p> send complete </p>";
}
?>
<?php $c = new Weiboclient (Wb_akey, Wb_skey, $_session[' Last_key '] [' Oauth_token '], $_session[' Last_key '] [' Oaut H_token_secret ']); $t = ' new microblog '; $p = '/program/uploadpic/2012-4/20124511228944.jpg '; $RR = $c->upload ($t, $p); echo "<p> send complete </p>"; }?>
The following is a description of the public method in class Weiboclient.
Class Weiboclient
{
/**
* Constructor
*
* @access Public
* @param mixed $akey Weibo open platform app KEY
* @param mixed $skey Weibo open platform app SECRET
* @param mixed $ACCECSS _token OAuth certification return token
* @param mixed $ACCECSS _token_secret OAuth certification return token secret
* @return void
*/
function __construct ($akey, $skey, $accecss _token, $accecss _token_secret)
/**
* Latest Public microblog
*
* @access Public
* @return Array
*/
function Public_timeline ()
/**
* Latest focus on Weibo
*
* @access Public
* @return Array
*/
function Friends_timeline ()
/**
* Latest focus on Weibo
*
* @access Public
* @return Array
*/
function Home_timeline ()
/**
* Latest @ User's
*
* @access Public
* @param int $page The number of the page that returns the result.
* @param int $count The maximum number of records (that is, page size) that is returned each time, not greater than 200, and the default is 20.
* @return Array
*/
function mentions ($page = 1, $count = 20)
/**
* Publication of micro-blog
*
* @access Public
* @param mixed $text to update the microblogging information.
* @return Array
*/
function Update ($TEXT)
/**
* Publish Photo Weibo
*
* @access Public
* @param string $text to update the microblogging information.
* @param string $text The path of the picture to be published, supporting the URL. [Only support Png/jpg/gif three formats, add formatting please modify Get_image_mime method
]
* @return Array
*/
function upload ($text, $pic _path)
/**
* Get a single Micro blog
*
* @access Public
* @param mixed $sid To obtain the published microblog ID
* @return Array
*/
function Show_status ($SID)
/**
* Delete Weibo
*
* @access Public
* @param mixed $sid To remove the microblog ID
* @return Array
*/
function Delete ($SID)
/**
* Delete Weibo
*
* @access Public
* @param mixed $sid To remove the microblog ID
* @return Array
*/
function Destroy ($SID)
/**
* Personal Data
*
* @access Public
* @param mixed $uid _or_name user uid or Weibo nickname.
* @return Array
*/
function Show_user ($uid _or_name = null)
/**
* List of interested people
*
* @access Public
* @param bool $cursor single page can only contain 100 list of concerns, in order to get more then cursor default starting from-1, by adding or reducing cursor to obtain
Take more attention to the list
* @param bool $count The maximum number of records per return (that is, page size), not greater than 200, default returns 20
* @param mixed $uid _or_name to get the UID or Weibo nickname
* @return Array
*/
function Friends ($cursor = false, $count = False, $uid _or_name = null)
/**
* Fan List
*
* @access Public
* @param bool $cursor single page can only contain a list of 100 fans, in order to get more then cursor default starting from-1, by adding or reducing cursor to obtain
Take a list of more fans
* @param bool $count The maximum number of records per return (that is, page size), not greater than 200, and returns 20 by default.
* @param mixed $uid _or_name to get the UID or Weibo nickname
* @return Array
*/
Function followers ($cursor = False, $count = False, $uid _or_name = null)
/**
* Focus on a user
*
* @access Public
* @param mixed $uid _or_name the user uid or Twitter nickname to be concerned
* @return Array
*/
function follow ($uid _or_name)
/**
* Cancel attention to a user
*
* @access Public
* @param mixed $uid _or_name to remove the user uid or Twitter nickname
* @return Array
*/
function unfollow ($uid _or_name)
/**
* Returns details of two user relationships
*
* @access Public
* @param mixed $uid _or_name the user uid to be judged
* @return Array
*/
function is_followed ($uid _or_name)
/**
* Users to publish a microblog list
*
* @access Public
* @param int $page page number
* @param int $count The maximum number of records to return each time, up to 200 entries, default 20.
* @param mixed $uid _or_name Specify user uid or Weibo nickname
* @return Array
*/
function User_timeline ($page = 1, $count = $uid _or_name = null)
/**
* Get DMS List
*
* @access Public
* @param int $page page number
* @param int $count The maximum number of records to return each time, up to 200 entries, default 20.
* @return Array
*/
function List_dm ($page = 1, $count = 20)
/**
* List of DMS sent
*
* @access Public
* @param int $page page number
* @param int $count The maximum number of records to return each time, up to 200 entries, default 20.
* @return Array
*/
function List_dm_sent ($page = 1, $count = 20)
/**
* Send DMS
*
* @access Public
* @param mixed $uid _or_name uid or Weibo nickname
* @param mixed $text The message content to occur, the text size must be less than 300 characters.
* @return Array
*/
function Send_dm ($uid _or_name, $text)
/**
* Delete a piece of DMS
*
* @access Public
* @param mixed $did The DMS primary key ID to be deleted
* @return Array
*/
function Delete_dm ($did)
/**
* Forwarding a tweet message.
*
* @access Public
* @param mixed $SID forwarded Weibo ID
* @param the forwarding information added by bool $text.
* @return Array
*/
Function repost ($sid, $text = False)
/**
* Comment on a microblog message
*
* @access Public
* @param mixed $sid to comment on the microblog ID
* @param mixed $text comments
* @param bool $cid Comment ID to comment
* @return Array
*/
function Send_comment ($sid, $text, $cid = False)
/**
* Comments Issued
*
* @access Public
* @param int $page page number
* @param int $count The maximum number of records to return each time, up to 200 entries, default 20.
* @return Array
*/
function Comments_by_me ($page = 1, $count = 20)
/**
* Latest Comments (by Time)
*
* @access Public
* @param int $page page number
* @param int $count The maximum number of records to return each time, up to 200 entries, default 20.
* @return Array
*/
function Comments_timeline ($page = 1, $count = 20)
/**
* Single Comment list (by micro-blog)
*
* @access Public
* @param mixed $SID The specified microblog ID
* @param int $page page number
* @param int $count The maximum number of records to return each time, up to 200 entries, default 20.
* @return Array
*/
function Get_comments_by_sid ($sid, $page = 1, $count = 20)
/**
* The number of comments on the micro-blog, the number of forwarding, a request to obtain up to 100.
*
* @access Public
* @param mixed $sids microblogging ID number list, separated by commas
* @return Array
*/
function Get_count_info_by_ids ($sids)
/**
* Reply to a microblog comment.
*
* @access Public
* @param mixed $sid Weibo ID
* @param mixed $text comments.
* @param mixed $cid Comment ID
* @return Array
*/
function reply ($sid, $text, $cid)
/**
* Returns the most recent 20 favorites from the user's publication and is consistent with the return content of the user's Favorites page.
*
* @access Public
* @param bool $page The page ordinal that returns the result.
* @return Array
*/
function Get_favorites ($page = False)
/**
* Collection of a micro-blog information
*
* @access Public
* @param Weibo ID of the mixed $sid collection
* @return Array
*/
function Add_to_favorites ($SID)
/**
* Delete the Microblog collection.
*
* @access Public
* @param mixed $sid The collection Weibo information ID to be deleted.
* @return Array
*/
function Remove_from_favorites ($SID)
function Verify_credentials ()
/**
* Change Avatar
*
*/
function Update_avatar ($pic _path)
}