{"id":170467,"date":"2013-02-23T18:36:05","date_gmt":"2013-02-23T14:36:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=170467"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=170467","title":{"rendered":"<span class=\"post_title\">\u041a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 vkontakte (vk.com) \u043d\u0430 C#<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/zhenskiyblog.ru\/wp-content\/uploads\/2012\/09\/vkontakte.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041a\u0430\u043a-\u0442\u043e \u0434\u0430\u0432\u043d\u043e \u0432\u0438\u0434\u0435\u043b \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0441\u0442\u0430\u0442\u044c\u044e, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 yandex. \u0412\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u0435\u044e, \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u00ab\u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435\u00bb. <br \/>  \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0445\u043e\u0436\u0438\u0439, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f.<\/p>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f HttpWebRequest \u0438 HttpWebResponse.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  <b>\u0428\u0430\u0433 1<\/b><\/p>\n<p>  \u0414\u043b\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c:  <\/p>\n<pre><code class=\"cs\">using System.Collections; using System.Net; using System.IO; using System.Text.RegularExpressions; using System.Drawing; <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e Net, \u0432 \u043d\u0435\u043c \u043c\u0435\u0442\u043e\u0434 GetHtml:  <\/p>\n<pre><code class=\"cs\">class Net     {                  string remixsid;  \/\/Id \u0441\u0435\u0441\u0441\u0438\u0438         public string lastCookies; \/\/\u041a\u0443\u043a\u0438          public string GetHtml(string url, string postData) \/\/\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u043e\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b         {             string HTML = &quot;&quot;;              Regex rex1 = new Regex(&quot;remixsid=(.*?);&quot;, RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);             if (url == &quot;0&quot;) return &quot;0&quot;; \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0443             HttpWebRequest myHttpWebRequest =(HttpWebRequest)HttpWebRequest.Create(url);             \/\/myHttpWebRequest.Proxy = new WebProxy(&quot;127.0.0.1&quot;, 8888); \/\/\u0412 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438             if (!String.IsNullOrEmpty(postData)) myHttpWebRequest.Method = &quot;POST&quot;;             myHttpWebRequest.Referer = &quot;https:\/\/vk.com&quot;;             myHttpWebRequest.UserAgent = &quot;Mozila\/14.0 (compatible; MSIE 6.0;Windows NT 5.1; SV1; MyIE2;&quot;;             myHttpWebRequest.Accept = &quot;image\/gif, image\/x-xbitmap, image\/jpeg,image\/pjpeg, application\/x-shockwave-flash,application\/vnd.ms-excel,application\/vnd.ms-powerpoint,application\/msword&quot;;             myHttpWebRequest.Headers.Add(&quot;Accept-Language&quot;, &quot;ru&quot;);             myHttpWebRequest.ContentType = &quot;application\/x-www-form-urlencoded&quot;;             myHttpWebRequest.KeepAlive = false;              \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0421ookie, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435             if (!String.IsNullOrEmpty(this.remixsid))             {                 lastCookies = &quot;remixchk=5;remixsid=&quot; + this.remixsid;             }             if (!String.IsNullOrEmpty(lastCookies))             {                 myHttpWebRequest.Headers.Add(System.Net.HttpRequestHeader.Cookie, lastCookies);             }             \/\/ \u0441\u0442\u0430\u0432\u0438\u043c False, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 302, \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c              \/\/ \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f             myHttpWebRequest.AllowAutoRedirect = false;                       \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b             string sQueryString = postData;             byte[] ByteArr = System.Text.Encoding.GetEncoding(1251).GetBytes(sQueryString); \/\/\u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u0438\u0440\u0438\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443             try             {                 if (!String.IsNullOrEmpty(postData))                 {                     myHttpWebRequest.ContentLength = ByteArr.Length;                     myHttpWebRequest.GetRequestStream().Write(ByteArr, 0, ByteArr.Length);                 };                  \/\/ \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441                 HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();                 StreamReader myStreamReader;                                  \/\/\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c Cookie                  lastCookies = String.IsNullOrEmpty(myHttpWebResponse.Headers[&quot;Set-Cookie&quot;]) ? &quot;&quot; : myHttpWebResponse.Headers[&quot;Set-Cookie&quot;];                 Match matc1 = rex1.Match(lastCookies);                                  \/\/\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0438\u043c\u044f \u0441\u0435\u0441\u0441\u0438\u0438, \u0442\u043e \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u043c Cookie                  if (matc1.Groups.Count == 2) { this.remixsid = matc1.Groups[1].ToString(); lastCookies = &quot;remixchk=5;remixsid=&quot; + this.remixsid; }                 if (myHttpWebResponse.Headers[&quot;Content-Type&quot;].IndexOf(&quot;windows-1251&quot;) &gt; 0)                 {                     myStreamReader = new StreamReader(myHttpWebResponse.GetResponseStream(), Encoding.GetEncoding(&quot;windows-1251&quot;));                 }                 else                 {                     myStreamReader = new StreamReader(myHttpWebResponse.GetResponseStream(), Encoding.UTF8);                 }                 HTML = myStreamReader.ReadToEnd();                 if (HTML == &quot;&quot;) \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442                 {                     HTML = this.GetHtml(myHttpWebResponse.Headers[&quot;Location&quot;].ToString(), &quot;&quot;);                  }             }             catch (Exception err)             {                 \/\/\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0447\u0442\u0435\u043d\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b                 return &quot;0&quot;;             }             return HTML;         }     } <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u044f \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u044e \u043a\u0443\u043a\u0438. \u042d\u0442\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u043d\u043e, \u0442.\u043a. \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043a\u0443\u043a\u0438 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043b \u043a\u0443\u043a\u0438. \u0410 \u0432 \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>  <b>\u0428\u0430\u0433 2<\/b><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 http \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e.  <\/p>\n<pre><code class=\"cs\">Net http = new Net(); \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 string post = &quot;email=&quot; + this.login + &quot;&pass=&quot; + this.password + &quot;&q=1&act=login&q=1&al_frame=1&expire=&captcha_sid=&captcha_key=&from_host=vk.com&from_protocol=http&ip_h=4e78766a2890ac1115&quick_expire=1&quot;;              string html = http.GetHtml(&quot;https:\/\/vk.com\/&quot;, &quot;&quot;); html = http.GetHtml(&quot;https:\/\/login.vk.com\/?act=login&quot;, post); <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043b\u043e\u0433\u0438\u043d\u043e\u043c \u0438 \u043f\u0430\u0440\u043e\u043b\u0435\u043c.<\/p>\n<p>  \u0412 \u043e\u0442\u0432\u0435\u0442 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"javascript\">&lt;script type=&quot;text\/javascript&quot;&gt; var _ua = navigator.userAgent; var locDomain = 'vk.com'.match(\/[a-zA-Z]+\\.[a-zA-Z]+\\.?$\/)[0]; if (\/opera\/i.test(_ua) || !\/msie 6\/i.test(_ua) || document.domain != locDomain) {   document.domain = locDomain; } parent.__qlClear(); parent.onLoginDone('\/id62983254'); &lt;\/script&gt; <\/code><\/pre>\n<p>  <b>\u0428\u0430\u0433 3<\/b><\/p>\n<p>  \u0412\u044b\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 Id:  <\/p>\n<pre><code class=\"cs\">Regex rex4 = new Regex(&quot;parent\\\\.onLoginDone\\\\(\\\\'(.*?)\\\\'\\\\)&quot;, RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); matc4 = rex4.Match(html); this.userid = matc4.Groups[1].ToString().Replace(&quot;\/id&quot;, &quot;&quot;); <\/code><\/pre>\n<p>  <b>\u0428\u0430\u0433 4<\/b><\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438:  <\/p>\n<pre><code class=\"cs\">html = http.GetHtml(&quot;https:\/\/vk.com\/id&quot; + this.userid, &quot;&quot;); int status = Testlogin(html); <\/code><\/pre>\n<p>  status==1 \u2014 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e<br \/>  status==2 \u2014 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d<br \/>  status==3 \u2014 \u043e\u0448\u0438\u0431\u043a\u0430 \u043b\u043e\u0433\u0438\u043d\u0430 \u0438\u043b\u0438 \u043f\u0430\u0440\u043e\u043b\u044f<br \/>  status==4 \u2014 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/p>\n<p>  \u041a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043d\u0430 \u043a\u0430\u043f\u0447\u0443:  <\/p>\n<pre><code class=\"cs\">        private int Testlogin(string html)         {             if (html.IndexOf(&quot;login?act=blocked&quot;) &gt; 0) { this.status = 2; return 2; }             if (html.IndexOf(&quot;onLoginFailed&quot;) &gt; 0) { this.status = 3; return 3; }             Regex rex1 = new Regex(&quot;href=\\&quot;\\\\\/edit\\&quot;&quot;, RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);             Match matc1 = rex1.Match(html);             if (matc1.Groups[0].Length == 0) { this.status = 4; return 4; }             this.status = 1;             return 1;         }         private string TestCaptch(string html)         {              Regex rex1 = new Regex(&quot;captcha_sid\\\\\\&quot;:\\\\\\&quot;(\\\\d*)\\\\\\&quot;&quot;, RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);             Match matc1 = rex1.Match(html);             if (matc1.Groups[1].Length == 0) return &quot;0&quot;;             return matc1.Groups[1].ToString();         } <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 TestCaptch \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 Id \u043a\u0430\u043f\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0440\u0430\u0437\u0433\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u0438.<\/p>\n<p>  <b>\u0428\u0430\u0433 5<\/b><\/p>\n<p>  \u0420\u0430\u0437\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u043f\u0447\u0443.<\/p>\n<p>  \u0412 \u043a\u043b\u0430\u0441\u0441 Net \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434:  <\/p>\n<pre><code class=\"cs\"> public Image GetImg(string url, Image image) \/\/\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435         {             string postData = &quot;&quot;;             string HTML = &quot;&quot;;             HttpWebRequest myHttpWebRequest =               (HttpWebRequest)HttpWebRequest.Create(                 url);             \/\/myHttpWebRequest.Proxy = new WebProxy(&quot;127.0.0.1&quot;, 8888);             if (!String.IsNullOrEmpty(postData)) myHttpWebRequest.Method = &quot;POST&quot;;             myHttpWebRequest.Referer = &quot;http:\/\/vk.com&quot;;             myHttpWebRequest.UserAgent = &quot;Mozila\/4.0 (compatible; MSIE 6.0;Windows NT 5.1; SV1; MyIE2;&quot;;             myHttpWebRequest.Accept = &quot;image\/gif, image\/x-xbitmap, image\/jpeg,image\/pjpeg, application\/x-shockwave-flash,application\/vnd.ms-excel,application\/vnd.ms-powerpoint,application\/msword&quot;;             myHttpWebRequest.Headers.Add(&quot;Accept-Language&quot;, &quot;ru&quot;);             myHttpWebRequest.ContentType = &quot;application\/x-www-form-urlencoded&quot;;             myHttpWebRequest.KeepAlive = false;              \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c Cookie, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435                     if (!String.IsNullOrEmpty(this.remixsid))             {                 lastCookies = &quot;remixchk=5;remixsid=&quot; + this.remixsid;             }             if (!String.IsNullOrEmpty(lastCookies))             {                 myHttpWebRequest.Headers.Add(HttpRequestHeader.Cookie, lastCookies);             }             \/\/ \u0441\u0442\u0430\u0432\u0438\u043c False, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 302, \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c              \/\/ \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f             myHttpWebRequest.AllowAutoRedirect = true;                       \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b             string sQueryString = postData;             byte[] ByteArr = System.Text.Encoding.GetEncoding(1251).GetBytes(sQueryString);              if (!String.IsNullOrEmpty(postData))             {                 myHttpWebRequest.ContentLength = ByteArr.Length;                 myHttpWebRequest.GetRequestStream().Write(ByteArr, 0, ByteArr.Length);             };              \/\/ \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441              try             {                 HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();                 StreamReader myStreamReader;                                  if (myHttpWebResponse.Headers[&quot;Content-Type&quot;].IndexOf(&quot;windows-1251&quot;) &gt; 0)                 {                     myStreamReader = new StreamReader(myHttpWebResponse.GetResponseStream(), Encoding.GetEncoding(&quot;windows-1251&quot;));                 }                 else                 {                     myStreamReader = new StreamReader(myHttpWebResponse.GetResponseStream(), Encoding.UTF8);                 }                 image = Image.FromStream(myHttpWebResponse.GetResponseStream());                 HTML = myStreamReader.ReadToEnd();                 myHttpWebResponse.Close();                 if (HTML == &quot;&quot;) HTML = myHttpWebResponse.Headers[&quot;Location&quot;].ToString();             }             catch (Exception err)             {                 \/\/\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0447\u0442\u0435\u043d\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b                 return image;             }             return image;         } <\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 GetHtml, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 Image \u0441 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u043a\u0430\u043f\u0447\u0435\u0439.<\/p>\n<p>  \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448\u0443 \u0444\u043e\u0440\u043c\u0443:  <\/p>\n<pre><code class=\"cs\">        public void Addcap(string sid)         {             this.img = &quot;http:\/\/vk.com\/captcha.php?sid=&quot; + sid;                        Image image = net.GetImg(img, pictureBox1.Image);             pictureBox1.Image = image; \/\/\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 PictureBox, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u0430 \u043a\u0430\u043f\u0447\u0430          } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043d\u0430\u0448\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043a\u0430\u043f\u0447\u0443 \u0434\u0430\u043b\u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0433\u0430\u0434\u0430\u0442\u044c \u043a\u0430\u043f\u0447\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u043d\u043e\u0432\u043e, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 &#038;captcha_key= \u0438 &#038;captcha_sid=<\/p>\n<p>  \u041a \u0441\u043b\u043e\u0432\u0443, \u0440\u0430\u0437\u0433\u0430\u0434\u0430\u0442\u044c \u043a\u0430\u043f\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0432 \u0440\u0443\u0447\u043d\u0443\u044e, \u0442\u0430\u043a \u0438 \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u0441 Antigate. <\/p>\n<p>  \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0435\u043d\u0443 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cs\">post = &quot;act=post&hash=&quot; + hash + &quot;&message=&quot; + textu + &quot;&al=1&captcha_key=&quot; + captcha_key + &quot;&captcha_sid=&quot; + captcha_sid + &quot;&facebook_export=&fixed=&friends_only=&from=&note_title=&official=&signed=&status_export=&attach1_type=&quot; + attachtype + &quot;&attach1=&quot; + attach + &quot;&to_id=&quot; + this.userid + &quot;&type=all&url=&quot; + System.Web.HttpUtility.UrlEncode(sendurl) + &quot;&title=&quot; + title + &quot;&photo_url=&quot; + System.Web.HttpUtility.UrlEncode(img); <\/code><\/pre>\n<p>  captcha_key \u2014 \u0440\u0430\u0437\u0433\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u043a\u0430\u043f\u0447\u0430<br \/>  captcha_sid \u2014 id \u043a\u0430\u043f\u0447\u0438<br \/>  sendurl \u2014 \u0441\u0441\u044b\u043b\u043a\u0430 \u0432 \u0442\u0435\u043b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f<br \/>  img \u2014 \u0430\u0434\u0440\u0435\u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0434\u043b\u044f \u0441\u0441\u044b\u043b\u043a\u0438<br \/>  textu \u2014 \u0441\u0430\u043c \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f<\/p>\n<p>  \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 Hash, \u043d\u043e \u0435\u0433\u043e \u043c\u043d\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u044f \u0434\u043e\u0441\u0442\u0430\u044e \u0435\u0433\u043e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u043e\u0439, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0439\u0434\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0433\u0440\u0443\u043f\u043f\u044b.  <\/p>\n<pre><code class=\"cs\">Regex rex2 = new Regex(&quot;\\&quot;post_hash\\&quot;:\\&quot;(.*?)\\&quot;&quot;, RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); Match matc2 = rex2.Match(html); string hash = matc2.Groups[1].ToString(); <\/code><\/pre>\n<p>  <b>P.S.<\/b><br \/>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u0442\u043e-\u0442\u043e \u0441\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u0435\u0439 \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430, \u043d\u043e, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e API c \u043e\u0434\u043d\u043e\u0433\u043e IP, \u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u0431\u0430\u043d\u044f\u0442\u0441\u044f. \u0410 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.<\/p>\n<p>  \u041d\u043e \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u044f \u0431\u044b \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 \u043f\u043e \u0438\u0445 Id, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 API, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0434\u0430\u043d\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u043c\u043e\u0433\u0443 \u0432 \u043b\u0438\u0447\u043a\u0443 \u0441\u043a\u0438\u043d\u0443\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043f\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 Antigate. \u041e\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0438 \u043a \u0442\u0435\u043c\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0442\u0443\u0442 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0441\u0442\u0430\u043b.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/170467\/\"> http:\/\/habrahabr.ru\/post\/170467\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/zhenskiyblog.ru\/wp-content\/uploads\/2012\/09\/vkontakte.jpg\" alt=\"image\"\/><\/p>\n<p>  \u041a\u0430\u043a-\u0442\u043e \u0434\u0430\u0432\u043d\u043e \u0432\u0438\u0434\u0435\u043b \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0441\u0442\u0430\u0442\u044c\u044e, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 yandex. \u0412\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u0435\u044e, \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u00ab\u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435\u00bb. <br \/>  \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0445\u043e\u0436\u0438\u0439, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f.<\/p>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f HttpWebRequest \u0438 HttpWebResponse.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-170467","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/170467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=170467"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/170467\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=170467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=170467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=170467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}