function get_me_person($consumer_data, $session_creds)
{
    require_once 'HTTP_Request_Oauth.php';
    $me_url = api_url('me');
    $req = new HTTP_Request_Oauth($me_url, array('consumer_key' => $consumer_data['key'], 'consumer_secret' => $consumer_data['secret'], 'token' => $session_creds['token'], 'token_secret' => $session_creds['token_secret'], 'signature_method' => 'HMAC-SHA1', 'method' => 'GET'));
    $request_timer -= microtime(true);
    $resp = $req->sendRequest(true, true);
    $request_timer += microtime(true);
    message("Bypassed cache at {$me_url} Request timer: " . $request_timer . "s");
    if (!$resp) {
        throw new Exception("Request to {$me_url} failed. ");
    }
    if ($req->getResponseCode() == 401) {
        throw new Exception("Request for /me failed to authorize.");
    }
    return get_person_from_string($req->getResponseBody());
}
Example #2
0
 function get_person_from_string($str)
 {
     return get_person_from_string($str);
 }