我需要一个" post" -api请求,XML返回数据。
我需要使用帖子,因为限制为〜 2000个字符,我需要在orsearch
中发送大量数据。我做错了什么,我该怎么调试呢?
var clientt = new HttpClient();
clientt.BaseAddress = new Uri("http://www.stuff.com");
var request = new HttpRequestMessage(HttpMethod.Post, "/ws/BIWS/service.php?");
var keyValues = new List<KeyValuePair<string, string>>();
keyValues.Add(new KeyValuePair<string, string>("key", "sdf9"));
keyValues.Add(new KeyValuePair<string, string>("type", "find"));
keyValues.Add(new KeyValuePair<string, string>("query", "funktioner:orsearch('4804255620')"));
request.Content = new FormUrlEncodedContent(keyValues);
var response = await clientt.SendAsync(request);
string content = await response.Content.ReadAsStringAsync();
// Error wrong key entered or something, but url works fine