Skip to content

tyan-boot/TiebaHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

#Baidu Tieba Helper

A simple class of Baidu tieba operations


###What can we do?

  • Easy to login via password or only cookie
  • Post your new topic just needs title and content
  • Send your comment by topic id
  • Automatically sign the tieba you liked via mobile API
  • Return verify code if it is essential

###How should you use it?

####Inlcude it

include 'TiebaHelper.php';

####Create a new instance

//Give user name and password when construct
$tb = new TiebaHelper(YOUR_ID, YOUR_PASSWORD);

//or set it later
$tb = new TiebaHelper();
$tb->SetUser(USER_NAME);
$tb->SetPW(USER_PASSWORD);

//Then log in
$rtn = $tb->Login();

//Check $rtn['err_no']

if ($rtn['err_no'] == 0)
{
  //Login success
}else
{
  if ($rtn['err_no'] == 257)
  {
    //You need vcode
    $imgUrl = $rtn['imgUrl'];
    //Open url above and get the code
    //and login again
    $rtn = $tb->Login(VCODE_YOU_GOT_BEFORE);
    
    if($rtn['err_no'] == 0)
    {
      //login success
    }else
    {
      //sorry still error
      //but who care?
    }
  }
}

####Post a new topic

//First set tieba name
$tb->SetTieba(TIEBA_NAME);

//Then post
$tb->Post(Title, content);

####Sent comment

//First set tieba name
$tb->SetTieba(TIEBA_NAME);

//Then set topic id,which can be found in topic Uri
$tb->SetTid(TID);

//Eventually just comment
$tb->Comment(CONTENT);

####Sign your tieba

//Simply call Sign method
$tb->Sign();

//Get sign states
$signstates = $tb->GetSignStates();
//Then $signstates is an array in which object is about all information that Baidu server responsed

###Other Contact with me by email [email protected] if you have any question:)

About

A class for Baidu Tieba operation,such as login,post a topic,reply and sign.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages