You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
<Query Kind="Statements"> |
|
<Reference><RuntimeDirectory>\System.Net.Http.dll</Reference> |
|
<Namespace>System.Net.Http</Namespace> |
|
<Namespace>System.Net.Http.Headers</Namespace> |
|
<Namespace>System.Threading.Tasks</Namespace> |
|
</Query> |
|
|
|
string Token = "MDAxY2xvY2F0aW9uIHBvc3QuaHlydWxlLmNjCjAwMTNpZGVudGlmaWVyIGtleQowMDEwY2lkIGdlbiA9IDEKMDAyOWNpZCB1c2VyX2lkID0gQGNsYWlyZTpwb3N0Lmh5cnVsZS5jYwowMDE2Y2lkIHR5cGUgPSBhY2Nlc3MKMDAyMWNpZCBub25jZSA9IHVpcCw0Q0xXeno5RWVIemsKMDAyZnNpZ25hdHVyZSC-SU60mVgCMmO7leht6DEkzsRkjIMeQnuAbQzNLRemEgo"; |
|
string Url = "https://post.hyrule.cc/_matrix/client/r0/joined_rooms"; |
|
|
|
HttpClient client = new HttpClient(); |
|
|
|
string newUrl = Url + "?access_token=" + Token; |
|
|
|
HttpResponseMessage response = await client.GetAsync(newUrl); |
|
|
|
string result = ""; |
|
|
|
if (response.IsSuccessStatusCode) |
|
{ |
|
result = await response.Content.ReadAsStringAsync(); |
|
} |
|
|
|
Console.WriteLine(result); |
|
|
|
Console.WriteLine(); |
|
|
|
HttpClient client2 = new HttpClient(); |
|
|
|
client2.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Token); |
|
|
|
HttpResponseMessage response2 = await client2.GetAsync(Url); |
|
|
|
string result2 = ""; |
|
|
|
if (response2.IsSuccessStatusCode) |
|
{ |
|
result2 = await response2.Content.ReadAsStringAsync(); |
|
} |
|
|
|
Console.WriteLine((int)response2.StatusCode + " : " + response2.StatusCode); |
|
Console.WriteLine(result2); |