Exemplo n.º 1
0
 public static function isRegistered($forlife)
 {
     global $globals;
     $payload = '';
     $method = 'GET';
     $resource = '/api/1/user/' . $forlife . '/isRegistered';
     $timestamp = time();
     $message = implode('#', array($method, $resource, $payload, $timestamp));
     $token = $globals->xorg->hash;
     $sig = hash_hmac('sha256', $message, $token);
     $get = '?user='******'&timestamp=' . $timestamp . '&sig=' . $sig;
     $url = $globals->xorg->url . $resource . $get;
     $a = new xorgAPI($url);
     $a->exec();
     if ($a->http_code() == 404) {
         throw new xorgUnkonwnUserException("{$forlife} doesn't seem to exist");
     }
     $json = json_decode($a->response());
     return $json->isRegistered;
 }