Wiz note SDK

Source: Internet
Author: User
I wrote an sdk for wiz notes. The main function of github. comjiankersWizSDK is to log on to wiz. Extract user information. Extract the list of note directories. Extract the list of notes. Extract the notes. Who needs fork? No source code or demonstration: source code? PhpincludeWizSDK. class. php; $ usernameexample @ examp

For wiz notes written an sdk, https://github.com/jiankers/WizSDK main function Introduction: Login wiz. Extract user information. Extract the list of note directories. Extract the list of notes. Extract the notes. Who needs fork? No source code or demonstration: source code? Phpinclude "WizSDK. class. php"; $ username = "example @ examp

Write an sdk for wiz notes, https://github.com/jiankers/WizSDK
Main functions:

Log on to wiz.

Extract user information.

Extract the list of note directories.

Extract the list of notes.

Extract the notes.
Who needs fork? <无>

Source code and demo:Source code

  Debug = true; // log on to $ info = $ wiz-> login (); $ token = $ info ['Token']; $ kb_guid = $ info ['kb _ guid']; // get user information $ userinfo = $ wiz-> getUserInfo ($ token ); // get the directory list $ dirinfo = $ wiz-> getDirList ($ token, $ kb_guid); if (! Isset ($ _ GET ['dir']) &! Isset ($ _ GET ['id']) {echo"
  
 
    "; Foreach ($ dirinfo ['LIST'] as $ dirs) {$ dir = urlencode ($ dirs ['location']); echo"
  • ". $ Dirs ['category _ name']."
  • ";} Echo"
";} If (isset ($ _ GET ['dir']) {// GET the list of notes in each directory $ doclist [] = $ wiz-> getDirDocList ($ token, $ kb_guid, $ _ GET ['dir']); echo"
    "; Foreach ($ doclist as $ doc) {foreach ($ doc ['LIST'] as $ note) {echo"
  • ". $ Note ['document _ title']."
  • ";}} Echo"
";} If (isset ($ _ GET ['id']) {$ document_guid = $ _ GET ['id']; $ info = $ wiz-> getDirDocShow ($ token, $ kb_guid, $ document_guid ); // echo preg_replace ("/src \ = '\/unzip \/", "src = 'HTTP: // beta.note.wiz.cn/unzip /", $ info ['document _ info'] ['document _ body']);}
  * @ License http://www.php0.net/ * @ Version 0.1 * @ lastmodify2013-10-25 */class WizSDK {private $ apiurl =' http://beta.note.wiz.cn '; Private $ username = ''; private $ passwd =''; public $ debug = true; // when debug is enabled, log on to function _ construct ($ username, $ passwd) {$ this-> username = $ username; $ this-> passwd = $ passwd;}/*** logon verification * this method can be executed once, because the wiz note does not need to verify logon, this method is used to obtain the token & kb_guid for other methods. Use */public function login () {if (! File_exists ('./user. ini') | $ this-> debug = false) {ob_start (); // enable cache // login authentication $ url =" http://note.wiz.cn/api/login "; $ Post_data = array (" user_id "=> $ this-> username," password "=> $ this-> passwd," isKeep_password "=>" off ", "debug" => ""); $ cookie_jar = tempnam ('. /temp ', 'cookies'); // The file storing cookies $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ url); curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_HEADER, 0); curl_setopt ($ ch, expires, 0); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post_data); curl_setopt ($ c H, CURLOPT_COOKIEJAR, $ cookie_jar); // Save the cookie information curl_exec ($ ch); curl_close ($ ch); $ json = ob_get_contents (); // write it into the configuration file @ file_put_contents ('. /user. ini ', $ json); ob_clean ();} else {$ json = file_get_contents ('. /user. ini ');} return json_decode ($ json, true);} // get user information public function getUserInfo ($ token) {$ token = isset ($ _ GET ['Token'])? $ _ GET ['Token']: $ token; $ url = $ this-> apiurl. "/api/user/info? Client_type = web2.0 & api_version = 3 & token = {$ token} & _= 1385364125279 "; $ info = @ file_get_contents ($ url); return json_decode ($ info, true );} // GET the directory list public function getDirList ($ token, $ kb_guid) {$ token = isset ($ _ GET ['Token'])? $ _ GET ['Token']: $ token; $ kb_guid = isset ($ _ GET ['kb _ guid'])? $ _ GET ['kb _ guid ']: $ kb_guid; $ url = $ this-> apiurl. "/api/category/all? Client_type = web2.0 & api_version = 3 & token = {$ token} & kb_guid = {$ kb_guid} & _= 1385364126264 "; $ info = @ file_get_contents ($ url ); return json_decode ($ info, true);} // obtain the public function getDirDocList ($ token, $ kb_guid, $ dir) in the directory) {$ token = isset ($ _ GET ['Token'])? $ _ GET ['Token']: $ token; $ kb_guid = isset ($ _ GET ['kb _ guid'])? $ _ GET ['kb _ guid ']: $ kb_guid; $ dir = isset ($ _ GET ['dir'])? Urlencode ($ _ GET ['dir']): $ dir; $ url = $ this-> apiurl. "/api/document/list? Client_type = web2.0 & api_version = 3 & token = {$ token} & action_cmd = category & action_value = {$ dir} & kb_guid = {$ kb_guid} & _ = 1385366664005 "; $ info = @ file_get_contents ($ url); return json_decode ($ info, true);} // obtain the public function getDirDocShow ($ token, $ kb_guid, $ document_guid) in the directory) {$ token = isset ($ _ GET ['Token'])? $ _ GET ['Token']: $ token; $ kb_guid = isset ($ _ GET ['kb _ guid'])? $ _ GET ['kb _ guid ']: $ kb_guid; $ document_guid = isset ($ _ GET ['document _ guid'])? $ _ GET ['document _ guid ']: $ document_guid; $ url = $ this-> apiurl. "/api/document/info? Client_type = web2.0 & api_version = 3 & token = {$ token} & kb_guid = {$ kb_guid} & document_guid = {$ document_guid} & _ = 1385370541346 "; $ info = @ file_get_contents ($ url); return json_decode ($ info, true );}}

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.