private void button1_Click(object sender, EventArgs e) { var httpDownload = new HttpSession(); var sPost = "{\"key\": \"64a5889c-e31d-4dc4-8fd0-edcc0f45f37d\"}";// "key=64a5889c-e31d-4dc4-8fd0-edcc0f45f37d"; string sUrl1 = "https://mandrillapp.com/api/1.0/tags/all-time-series.json"; string sUrl2 = "https://mandrillapp.com/api/1.0/users/info.json"; httpDownload.sContentType = "application/json"; httpDownload._iTimeOut = 3000; httpDownload.sAccept = "application/json"; // WebHeaderCollection.KeysCollection test = new System.Collections.Specialized.NameObjectCollectionBase.KeysCollection(); //httpDownload.Headers.Add("Accept", "application/json"); //httpDownload.Headers["Content-Type"] = "application/json"; httpDownload.PostMethodDownload(sUrl2, sPost, true, false, true, true); }
public string getCookieDestinet(string sUrl) { string destinet = ""; var httpDownload = new HttpSession(); var sPost = "dnn$ctr$Signin$Signin_textboxUsername=host" + "&dnn$ctr$Signin$Signin_textboxPassword=guidedes10no" + "&dnn$ctr$Signin$cmdLogin=Logg%20inn"; var sContent = httpDownload.GetMethodDownload(sUrl, true, false, false, true); // step 2 var _cookies = httpDownload.Cookies; string strRegex = "<input\\s+type=.{1}hidden.{1}\\s+name=.{1}__VIEWSTATE.{1}\\s+id=.{1}__VIEWSTATE.{1}\\s+value=.{1}([^.\"]+)"; Regex rxGetViewState = new Regex(strRegex); Match mViewState = rxGetViewState.Match(sContent); string sViewState = mViewState.Groups[1].Value;//.Replace("/", "%2F").Replace("=", "%3D"); sPost += "&__VIEWSTATE=" + sViewState; httpDownload.PostMethodDownload(sUrl, sPost, true, false, false, true); destinet = httpDownload.Cookies[".DESTINET"].Value; return destinet; }
private void timer1_Tick(object sender, EventArgs e) { var httpDownload = new HttpSession(); var sUrl = txtURLPost.Text;// "http://www.hnammobile.com/api/vote?item_id=79"; var sPost = ""; ///// //sUrl = txtUrl.Text; sPost = ""; httpDownload.PostMethodDownload(sUrl, sPost, true, false, false, false); count++; lbCount.Text = count.ToString(); }
private void button1_Click(object sender, EventArgs e) { var httpDownload = new HttpSession(); var sUrl = ""; var sPost = ""; ///// sUrl = txtUrl.Text; sPost = ""; CookieCollection Cookie = new CookieCollection(); var sContent = httpDownload.PostMethodDownload(sUrl, sPost, false, false, false, false); txtContent.Text = sContent; }
public string getCookieDestinet(string sUrl1, ref CookieCollection _cookies) { string destinet = ""; var httpDownload = new HttpSession(); var sPost = "dnn$ctr$Signin$Signin_textboxUsername=host" + "&dnn$ctr$Signin$Signin_textboxPassword=guidedes10no" + "&dnn$ctr$Signin$cmdLogin=Logg%20inn"; var sContent = httpDownload.GetMethodDownload(sUrl1, true, false, false, true); // step 2 _cookies = httpDownload.Cookies; string strRegex = "<input\\s+type=.{1}hidden.{1}\\s+name=.{1}__VIEWSTATE.{1}\\s+id=.{1}__VIEWSTATE.{1}\\s+value=.{1}([^.\"]+)"; Regex rxGetViewState = new Regex(strRegex); Match mViewState = rxGetViewState.Match(sContent); string sViewState = mViewState.Groups[1].Value;//.Replace("/", "%2F").Replace("=", "%3D"); sPost += "&__VIEWSTATE=" + sViewState; httpDownload.PostMethodDownload(sUrl1, sPost, true, false, false, true); if (httpDownload.Cookies[".DESTINET"] != null) { destinet = httpDownload.Cookies[".DESTINET"].Value; } else { if (txtCookie.Text != "") { Cookie c1 = new Cookie(".DESTINET", txtCookie.Text); c1.Domain = sUrl.Replace("http://", ""); c1.Expired = false; c1.Expires = DateTime.Now.AddMinutes(100); httpDownload.Cookies.Add(c1); } } _cookies = httpDownload.Cookies; return destinet; }