1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
| string _params = "";
string hash = "";
string rhash = "";
string mid = "";
string server = "";
string photo_id = "";
string vk_id = ParseOwnerUrl(textBox4.Text);
_params += url_param("act", "choose_photo");
_params += url_param("al", "1");
_params += url_param("scrollbar_width", "16");
_params += url_param("to_id", vk_id);
string s = PostWithCaptcha("http://vk.com/al_photos.php", _params);
Match m = Regex.Match(s, @"hash\x22:\x22(.{32})", RegexOptions.IgnoreCase | RegexOptions.Multiline);
hash = m.Groups[1].Value;
m = Regex.Match(s, @"rhash\x22:\x22(.{32})", RegexOptions.IgnoreCase | RegexOptions.Multiline);
rhash = m.Groups[1].Value;
m = Regex.Match(s, @"mid\x22:(\d+)", RegexOptions.IgnoreCase | RegexOptions.Multiline);
mid = m.Groups[1].Value;
m = Regex.Match(s, @"server: (\d+)", RegexOptions.IgnoreCase | RegexOptions.Multiline);
server = m.Groups[1].Value;
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create("http://cs" + server + ".vk.com/upload.php");
webReq.CookieContainer = mainCookieContainer;
using (MultiPartForm mult = new MultiPartForm(webReq))
{
mult.AddData("act", "do_add");
mult.AddData("ajx", "1");
mult.AddData("aid", "-14");
mult.AddData("gid", "0");
mult.AddData("mid", mid);
mult.AddData("hash", hash);
mult.AddData("rhash", rhash);
mult.AddData("vk", "1");
mult.AddData("from_host", "vk.com");
mult.AddData("al", "1");
mult.AddData("onfail", "Upload.callbacks.onfail0");
mult.AddData("ondone", "Upload.callbacks.ondone0");
mult.AddFile("photo", image_folder[sch_img]);
mult.AddFile("photo", image_folder[sch_img]);
}));
mult.Dispose();
}
HttpWebResponse webResponse = (HttpWebResponse)webReq.GetResponse();
StreamReader myStreamReader1 = new StreamReader(webResponse.GetResponseStream());
string Response_0 = myStreamReader1.ReadToEnd();
JObject jo = JObject.Parse(Response_0);
_params = "";
_params += url_param("act", "choose_uploaded");
_params += url_param("aid", jo["aid"].ToString());
_params += url_param("al", "1");
_params += url_param("gid", jo["gid"].ToString());
_params += url_param("mid", jo["mid"].ToString());
_params += url_param("hash", jo["hash"].ToString());
_params += url_param("server", jo["server"].ToString());
_params += url_param("photos", jo["photos"].ToString());
s = PostWithCaptcha("http://vk.com/al_photos.php", _params);
m = Regex.Match(s, @"<!>(-?\d+_\d+)<!>", RegexOptions.IgnoreCase | RegexOptions.Multiline);
if (m.Success)
{
photo_id = m.Groups[1].Value;
}
post_img_wall(photo_id, vk_id);
});
MyThread.Start();
} |