good day. I encountered the following problem, I want to parse the IDs of people when searching on VKontakte, but I don’t give me the whole list of people, why? Here is what I do:
method for sending a request
public string GLOBAL_SEARCH(string from, string to, string city, string country) { //string like = textBox4.Text.Substring(textBox4.Text.IndexOf("wall-", 0)); cook = null; cook = new CookieDictionary(); var request = new HttpRequest(); request.UserAgent = HttpHelper.ChromeUserAgent(); request.Cookies = cook; request.AddParam("al", "1"); request.AddParam("c[age_from]", from); request.AddParam("c[age_to]", to); request.AddParam("c[city]", city); request.AddParam("c[country]", country); request.AddParam("c[name]", "1"); request.AddParam("c[photo]", "1"); request.AddParam("c[section]", "people"); request.AddParam("change", "1"); HttpResponse response = request.Post("http://vk.com/al_search.php"); return response.ToString(); } parsing method response received:
string[] GLOBAL_SEARCH_GO() { string from = (string)numericUpDown1.Value.ToString(); string to = (string)numericUpDown2.Value.ToString(); string city = textBox5.Text; string country = textBox6.Text; List<string> f_list = new List<string>(); var request = new HttpRequest(); request.UserAgent = HttpHelper.ChromeUserAgent(); request.Cookies = cook; Regex newReg = new Regex("<div class=\"labeled name\"><a href=\"/(.*)\" onclick"); while (true) { var z = GLOBAL_SEARCH(from, to, city, country); MatchCollection matches = newReg.Matches(z); if (matches.Count <= 0) break; for (int i = matches.Count - 1, w = 1; i > -1; i--, w++) f_list.Add(matches[i].Groups[1].ToString()); } return f_list.ToArray(); } button event:
private void button7_Click(object sender, EventArgs e) { listBox2.Items.AddRange(GLOBAL_SEARCH_GO()); label11.Text = "Получено: " + listBox2.Items.Count.ToString(); } I use xNet library. If anything, authorization is not needed for the search.