因此,我正在制作一个程序,在其中输入一些信息。信息的一部分需要大量的文本,我们正在谈论100多个字符。我发现当数据量很大时,根本不会发送数据。这里是我使用的代码:发送大量POST数据
public void HttpPost(string URI, string Parameters)
{
// this is what we are sending
string post_data = Parameters;
// this is where we will send it
string uri = URI;
// create a request
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri);
request.KeepAlive = false;
request.ProtocolVersion = HttpVersion.Version10;
request.Method = "POST";
// turn our request string into a byte stream
byte[] postBytes = Encoding.ASCII.GetBytes(post_data);
// this is important - make sure you specify type this way
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postBytes.Length;
Stream requestStream = request.GetRequestStream();
// now send it
requestStream.Write(postBytes, 0, postBytes.Length);
requestStream.Close();
}
我然后调用该方法,像这样:
HttpPost(url, "data=" + accum + "&pass=HRS");
“ACCUM”是我发送大量数据。如果我发送少量数据,此方法有效。但是当它很大时它不会发送。有什么办法可以向我的网站上的.php页面发送超过100多个字符的发布请求?
谢谢。
你的问题不应该是100个字符的限制,你的accum变量中没有'?'或'&'吗? – Ciro
我不会:\我刚发送了这个http://puu.sh/urKY,它甚至没有发送它。 –