我现在很漂亮,因为我不断收到亚马逊的不完整回复。我正在使用Product Advertising API,向服务器发出一个ItemLookup请求。
C#代码非常基础:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
string resultString;
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
resultString = sr.ReadToEnd();
}
我收到的字符数是17408-非常稳定,但我也看到了16k左右的字符。
这就是它总是如此结束:
...ount><CurrencyCode>EUR</CurrencyCode><FormattedPrice>EUR 11,33</FormattedPri
我对HttpWebRequest或亚马逊的API有什么不了解的吗?请帮忙!
the url(不关心密钥)编辑:坏主意,超出限制......
答案 0 :(得分:3)
这对我有用:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Stream s = response.GetResponseStream();
using (StreamReader sr = new StreamReader(s))
{
s.Flush();
resultString = sr.ReadToEnd();
...
}