<?php require 'WeiyouxiClient.php'; try { $weiyouxi = new WeiyouxiClient('2603432055', 'cca518f66402e5423aa82171030af4bd'); $userId = $weiyouxi->getUserId(); //调用API接口 $info = $weiyouxi->get('user/show', array('uid' => 1936344094)); echo '请求接口成功:'; var_dump($info); } catch (Exception $e) { echo '请求接口失败:'; var_dump($e); }
<?php require 'config.php'; require 'WeiyouxiClient.php'; try { $weiyouxi = new WeiyouxiClient($appKey, $appSecret); $userId = $weiyouxi->getUserId(); //调用API接口 $info = $weiyouxi->get('user/show', array('uid' => $userId)); echo '请求接口成功:'; var_dump($info); } catch (Exception $e) { echo '请求接口失败:'; var_dump($e); } ?>
<?php require 'config.php'; require 'WeiyouxiClient.php'; try { $weiyouxi = new WeiyouxiClient($appKey, $appSecret); //if program can't get params(session_key,signature...) by GET //如果当前程序无法从GET中获取参数 则需执行下面这行代码 将你保存的session_key作为参数传入 $weiyouxi->setAndCheckSessionKey('session_key'); //如果还想检测签名 则需执行下面这行代码 将你保存的signature作为参数传入 $weiyouxi->setAndCheckSignature('signature'); $userId = $weiyouxi->getUserId(); //call api $me = $weiyouxi->get('user/show'); var_dump($me); } catch (Exception $e) { var_dump($e); }
<?php require 'config.php'; require 'WeiyouxiClient.php'; //使用SDK调用接口 try { //$appKey : your app key (source) ; $appSecret: your app secret $weiyouxi = new WeiyouxiClient($appKey, $appSecret); $data = $weiyouxi->get('leaderboards/get_total', array('rank_id' => 1)); var_dump($data); } catch (Exception $e) { var_dump($e); }