Answer the question
In order to leave comments, you need to log in
How to make a request correctly?
There is a code in PHP, I translate it into C#:
$fields = array(
'Page' => $page,
'Sides' => array(
),
);
$fields_string = http_build_query($fields);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
var values = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("Page", Page)
};
//как правильно тут добавить массив?
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync(ur, content);
Answer the question
In order to leave comments, you need to log in
Try
var values = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("Page", Page),
new KeyValuePair<string, string>("Sides[0]", side1),
new KeyValuePair<string, string>("Sides[1]", side2),
....
};
var values = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("Page", Page)
};
for(var i = 0; i < sides.Length;i++)
values.Add( new KeyValuePair<string, string>("Sides["+i+"]", sides[i]));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question