因此,我正在製作一個程序,在其中輸入一些信息。信息的一部分需要大量的文本,我們正在談論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,它甚至沒有發送它。 –