Skip to content

Instantly share code, notes, and snippets.

@dz1984
Created August 9, 2013 07:52
Show Gist options
  • Select an option

  • Save dz1984/6191866 to your computer and use it in GitHub Desktop.

Select an option

Save dz1984/6191866 to your computer and use it in GitHub Desktop.
簡介aNobii的API Methods
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