Created
August 9, 2013 07:52
-
-
Save dz1984/6191866 to your computer and use it in GitHub Desktop.
簡介aNobii的API Methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define('KEY','your_key'); | |
| define('SECRET','your_secret'); | |
| define('SIG',md5(KEY.SECRET)); | |
| define('PARAM','api_key='.KEY.'&api_sig='.SIG); | |
| define('SHELF_API','http://api.anobii.com/shelf/getSimpleShelf?'); | |
| define('ITEM_API','http://api.anobii.com/item/getInfo?'); | |
| define('AUTHOR_API','http://api.anobii.com/contributor/getInfo?'); | |
| //取得書籍的作者 | |
| function getAuthor($authorid,$itemid){ | |
| $param=PARAM.'&contributor_id='.$authorid.'&item_id='.$itemid; | |
| return file_get_contents(AUTHOR_API.$param); | |
| } | |
| //取得書籍的資料 | |
| function getBook($itemid){ | |
| $param=PARAM.'&item_id='.$itemid; | |
| return file_get_contents(ITEM_API.$param); | |
| } | |
| //取得使用者的書櫃 | |
| function getUser($userid){ | |
| $param=PARAM.'&user_id='.$userid; | |
| return file_get_contents(SHELF_API.$param); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment