вот как я отправляю через
post// сам post
public async Task<string> POST(string url, NameValueCollection nvc = null)
{
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = WebRequestMethods.Http.Post;
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0";
request.AllowAutoRedirect = true;
request.ProtocolVersion = HttpVersion.Version11;
request.AllowWriteStreamBuffering = true;
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Headers.Add("Accept-Language", "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3");
request.Headers.Add("Accept-Encoding", "gzip, deflate");
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
if (nvc != null)
{
Stream rs = request.GetRequestStream();
byte[] boundarybytes = Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}";
string _key = String.Empty;
foreach (string key in nvc.Keys)
{
rs.Write(boundarybytes, 0, boundarybytes.Length);
string formitem = string.Format(formdataTemplate, key, nvc[key]);
byte[] formitembytes = Encoding.UTF8.GetBytes(formitem);
rs.Write(formitembytes, 0, formitembytes.Length);
}
rs.Write(boundarybytes, 0, boundarybytes.Length);
}
return await Task.Run(() =>
{
string resp = RESPONSE(request);
return resp;
});
}
catch (Exception ex)
{
return ex.Message;
}
}
// post обращается к ответу
public string RESPONSE(HttpWebRequest request)
{
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string answer = "";
var headers = response.Headers.ToString();
if (Convert.ToInt32(response.StatusCode) == 302 || Convert.ToInt32(response.StatusCode) == 200)
{
using (Stream rspStm = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(rspStm, Encoding.UTF8, true))
{
answer = String.Empty; answer = reader.ReadToEnd();
}
}
return answer;
}
else
{
response.Close(); return WebUtility.HtmlDecode(response.StatusDescription);
}
}
catch (Exception ex)
{
return WebUtility.HtmlDecode(ex.Message);
}
}
//после этого сам код: (на примере wall.get)
public async System.Threading.Tasks.Task<bool> GetWall(int id_group, int offset = 0)
{
try
{
string url = "https://api.vk.com/method/wall.get?";
Main_Tools mt = new Main_Tools();
// вот что вам надо: создать коллекцию и передать в post (и добавлять/заполнять через for || foreach для вашего случая
NameValueCollection nvc = new NameValueCollection();
nvc.Add("access_token", VK_main.TOKEN);
nvc.Add("owner_id", id_group.ToString());
nvc.Add("count", "1");
if(offset != 0) nvc.Add("offset", offset.ToString());
nvc.Add("filter", "owner");
nvc.Add("v", VK_main.VERSION);
// добавляете сколько вам нужно параметров и передаёте в метод POST вторым аргументом
string t = await mt.POST(url, nvc);
dynamic d = JObject.Parse(t);
// и далее разбираете json
//.. и т.д.