RestSharp.dll というライブラリーを使います。
RestSharp.dll へのシンボリックリンクを コンパイル、実行するフォルダー内に作成します。
RESTSHARP.DLL FILE INFORMATION からダウンロード
http_get.cs
// --------------------------------------------------------------------
/*
http_get.cs
Mar/08/2018
*/
// --------------------------------------------------------------------
using System;
using System.IO;
using RestSharp;
// --------------------------------------------------------------------
class http_get
{
// --------------------------------------------------------------------
static void Main (string[] args)
{
Console.WriteLine ("*** 開始 ***");
const string host_in = "https://httpbin.org";
var client = new RestClient(host_in);
var request = new RestRequest("/get", Method.GET);
IRestResponse response = client.Execute(request);
var content = response.Content;
Console.WriteLine (response);
Console.WriteLine (content);
Console.WriteLine ("*** 終了 ***");
}
// --------------------------------------------------------------------
}
// --------------------------------------------------------------------
Makefile
http_get.exe : http_get.cs
mcs http_get.cs -r:RestSharp.dll
clean:
rm -f *.exe
実行コマンド
mono ./http_get.exe
次のバージョンで確認しました。
$ mono --version
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-3.2 Wed Jun 30 05:34:49 UTC 2021)