public static function getSocialRecord($gid, $raw = false)
	{
		$ch = curl_init(Configuration::getPrimaryGSLSNode() . '/' . $gid);
		if(Configuration::getCurlVerbose() >= 2) curl_setopt($ch, CURLOPT_VERBOSE, 1);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_HTTPGET, 1);
		curl_setopt($ch, CURLOPT_TIMEOUT, Configuration::getGSLSTimeout());
		$result = curl_exec($ch);
		
		if(curl_errno($ch) != CURLE_OK)
		{
			$ch = curl_init(Configuration::getSecondaryGSLSNode() . '/' . $gid);
			if(Configuration::getCurlVerbose() >= 2) curl_setopt($ch, CURLOPT_VERBOSE, 1);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_HTTPGET, 1);
			$result = curl_exec($ch);
			
			if(curl_errno($ch) != CURLE_OK)
			{
				throw new \Exception('Connection error: ' . curl_error($ch));
			}
		}
		
		$result = json_decode($result);
		curl_close($ch);
		
		if($result->responseCode != 200)
		{
			if($result->responseCode == 404)
				throw new SocialRecordNotFoundException($result->message);
			else
				throw new \Exception($result->message);
		}
		else
		{
			// verify JWT and extract SocialRecord
			$signer = new Sha512();
			
			$token = (new Parser())->parse((string) $result->socialRecord);
			
			$socialRecord = json_decode(base64_decode($token->getClaim('socialRecord')));
			
			$personalPublicKey = PublicKey::formatPEM($socialRecord->personalPublicKey);
			
			try
			{
				$token->verify($signer, $personalPublicKey);
			}
			catch(\Exception $e)
			{
				throw new SocialRecordIntegrityException('SocialRecord integrity compromised: ' . $e->getMessage());
			}
			
			if($raw)
				return $token;
			else
				return SocialRecordBuilder::buildFromJSON(json_encode($socialRecord, JSON_UNESCAPED_SLASHES));
		}
	}