我正在尝试使用 SnapHacks 库,但我遇到了 Api 调用问题。
该库可以在这里找到https://github.com/jasonanovak/snaphaxpy
当我进行此 API 调用时:
$opts['username'] = $_POST['u'];
$opts['password'] = $_POST['p'];
$opts['debug'] = TRUE;
$s = new Snaphax($opts);
$result = $s->login();
我得到回应:
SNAPHAX DEBUG: p1: m198sOkJEn37DjqZ32lpRu76xmw288xSQ9 SNAPHAX DEBUG: p2: 1.37216038466E+12 SNAPHAX DEBUG: s1: iEk21fuwZApXlz93750dmW22pw389dPwOkm198sOkJEn37DjqZ32lpRu76xmw288xSQ9 SNAPHAX DEBUG: s2: 1.37216038466E+12iEk21fuwZApXlz93750dmW22pw389dPwOk SNAPHAX DEBUG: s3: 93046e57a3c183186e9e24ebfda7ca04e7eb4d8119060a8a39b48014d4c5172b SNAPHAX DEBUG: s4: bfea75d4e369551c251cff3a308f9c4a23f96c75f9ef161068a7c7946713da57 SNAPHAX DEBUG: out: 930a7554e36155186e1cffeaf0af9c4423e94d8519ef1a8069b4c714d7c51a5b SNAPHAX DEBUG : POST 参数:{"username":"MyUsername","password":"MyPassword","timestamp":1.37216038466e+12,"req_token":"930a7554e36155186e1cffeaf0af9c4423e94d8519ef1a8069b4c714d7c51a5b"} SNAPHAX DEG: HTTP POST 代码返回错误: : 未经授权
function login() {
$ts = $this->api->time();
$out = $this->api->postCall(
'/ph/login',
array(
'username' => $this->options['username'],
'password' => $this->options['password'],
'timestamp' => $ts
),
$this->options['static_token'],
$ts
);
if (is_array($out) &&
!empty($out['auth_token'])) {
$this->auth_token = $out['auth_token'];
}
return $out;
}
$out 不返回令牌
如果有人熟悉库或 Snapchat API,将获得帮助