尝试使用 C# 将 HttpWebRequest 发布到 airframes.org 以获取飞机信息。这是我用于许多其他 POST 请求且没有问题的代码(与其他 url 一起使用),但它/我无法使用 ICAO24 编号 (A64294) 加载 airframes.org 页面。
var cookies = new CookieContainer();
ServicePointManager.Expect100Continue = false;
var request = (HttpWebRequest)WebRequest.Create("http://www.airframes.org/");
request.CookieContainer = cookies;
request.Method = "POST";
request.KeepAlive = true;
request.ContentType = "application/x-www-form-urlencoded";
using (var requestStream = request.GetRequestStream())
using (var writer = new StreamWriter(requestStream))
{
writer.Write("reg=&selcal=&icao24=A64294&submit=submit");
}
using (var responseStream = request.GetResponse().GetResponseStream())
using (var reader = new StreamReader(responseStream))
{
var result = reader.ReadToEnd();
Console.WriteLine(result);
}