示例#1
0
        public bool LogoutChilkat(ref Chilkat.Http http)
        {


            try
            {
                string pageSource1 = http.QuickGetStr("http://www.facebook.com/");

                if (pageSource1.Contains("\"h\"") && pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                {
                    string h = string.Empty;
                    string post_form_id = string.Empty;
                    string fb_dtsg = string.Empty;

                    if (pageSource1.Contains("\"h\""))
                    {
                        string strTemp = pageSource1.Substring(pageSource1.IndexOf("\"h\""), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        h = ArrTemp[3];
                    }
                    if (pageSource1.Contains("post_form_id") && pageSource1.Contains("fb_dtsg"))
                    {
                        string strTemp = pageSource1.Substring(pageSource1.IndexOf("post_form_id"), 200);
                        string[] ArrTemp = strTemp.Split('"');
                        post_form_id = ArrTemp[2];
                        fb_dtsg = ArrTemp[6];
                    }

                    Chilkat.HttpRequest reqLogout = new Chilkat.HttpRequest();
                    reqLogout.UsePost();
                    //req.Path = "/login.php?login_attempt=1";
                    reqLogout.RemoveAllParams();
                    reqLogout.AddHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16");
                    //req.SetFromUrl("http://www.facebook.com/login.php?login_attempt=1");

                    reqLogout.AddParam("post_form_id", post_form_id);
                    reqLogout.AddParam("fb_dtsg", fb_dtsg);
                    reqLogout.AddParam("ref", "mb");
                    reqLogout.AddParam("h", h);

                    Chilkat.HttpResponse respUsingPostURLEncoded = http.PostUrlEncoded("http://www.facebook.com/logout.php", reqLogout);
                    string ResponseLoginPostURLEncoded = respUsingPostURLEncoded.BodyStr;

                    string pageSource12 = http.QuickGetStr("http://www.facebook.com/");


                    return true;
                }

                return false;
            }
            catch (Exception ex)
            {
                 return false;
                Console.WriteLine(ex.Message);
            }

        }
示例#2
0
        public MimeHelper(System.IO.Stream inputStream)
        {
            using (System.IO.StreamReader sr = new System.IO.StreamReader(inputStream, true))
            {
                string streamContents = sr.ReadToEnd();

                Chilkat.MailMan mailMan = new Chilkat();
                mailMan.UnlockComponent(@"WRKSHRMAILQ_cFSLZe4MnB2y");
                m_email = new Chilkat.Email();
                if (!m_email.SetFromMimeText(streamContents))
                    throw new ArgumentException();
            }
        }
示例#3
0
        public String findRessourceXML(String nom, Chilkat.Xml xml)
        {
            xml.FirstChild2();

            while (xml != null)
            {
                // FindNextRecord *will* return the current record if it
                // matches the criteria.
                xml = xml.FindNextRecord("nom", nom + "*");

                if (xml != null)
                {
                    // Add the company name to the listbox.
                    String id = null;
                    id = xml.GetChildContent("id");

                    return id;
                }
            }
            return null;
        }
示例#4
0
        public void FillTree(TreeNodeCollection treeNodes, Chilkat.Xml xml)
        {
            foreach (TreeNode tree in treeNodes)
            {
                tree.Remove();
            }

            // Navigate to the first xml record.
            xml.FirstChild2();

            while (xml != null && xml.GetChildContent("nom") != "")
            {
               treeNodes.Add(new TreeNode(xml.GetChildContent("nom")));

                xml = xml.NextSibling();
            }
        }
 public void SetHttp(ref Chilkat.Http http)
 {
     this.http = http;
 }
 public void SetCookie(string rawCookieStr, ref Chilkat.Http http)
 {
     http.SetRequestHeader("Cookie", rawCookieStr); 
 }
示例#7
0
		public static string InsertBccRecipientsIntoMime(Chilkat.Email email)
		{
			if (email == null)
			{
				return string.Empty;
			}
		
			if (email.NumBcc < 1)
			{
				return email.GetMime();
			}

			// Build up a comma delimited string of the Bcc recipients in the email object but not in the mime content
			string mimeContent = email.GetMime();
			string unmodifiedBccContent = GetBccRecipientsFromMimeContent(mimeContent);
			List<string> bccRecipients = GetBccRecipientsFromObject(email);
			StringBuilder contentBuilder = new StringBuilder();
			foreach (string bccRecipient in bccRecipients) 
			{
				if (string.IsNullOrEmpty(unmodifiedBccContent) || !unmodifiedBccContent.ToString().Contains(bccRecipient))
				{
					contentBuilder.AppendFormat("{0}, ", bccRecipient);
				}
			}

			string additionalContent = contentBuilder.ToString();

			// No additional content to add to Bcc 
			if (string.IsNullOrEmpty(additionalContent))
			{
				return email.GetMime();
			}

			// Remove trailing delimiter and whitespace
			char[] charsToTrim = {',', ' '};
			additionalContent = additionalContent.TrimEnd(charsToTrim);

			StringBuilder newBccContent = new StringBuilder();
			if (string.IsNullOrEmpty(unmodifiedBccContent)) 
			{
				// No existing Bcc content, add as new field
				newBccContent.AppendFormat("{0} {1}{2}", BccToken, additionalContent, EndToken);				
			}
			else 
			{
				// append 'missing' items to existing Bcc content
				newBccContent.AppendFormat(", {0}", additionalContent);
			}
			return mimeContent.Insert(GetInsertIndex(mimeContent), newBccContent.ToString());
		}		
示例#8
0
        public bool CheckVerificationChilkat(string response, ref Chilkat.Http Http)
        {
            //** FB Account Check email varified or not ***********************************************************************************//
            #region  FB Account Check email varified or not
            string pageSourceCheck = string.Empty;
            pageSourceCheck = response;
            string pageSrc1 = string.Empty;
            string pageSrc2 = string.Empty;
            string pageSrc3 = string.Empty;
            string pageSrc4 = string.Empty;
            string substr1 = string.Empty;


            //if (pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step"))
            //{
            //    pageSrc1 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers");
            //}
            //if (pageSrc1.Contains("Fill out your Profile Info") && pageSrc1.Contains("Skip"))
            //{
            //    pageSrc2 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic");
            //}
            //if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
            //{
            //    pageSrc3 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=summary");
            //}
            //if (pageSrc3.Contains("complete the sign-up process"))
            //{
            //    return false;

            //}
            //if (pageSourceCheck.Contains("complete the sign-up process"))
            //{
            //    return false;
            //}
            //#endregion
            ////** FB Account Check email varified or not ***********************************************************************************//
            //return true;

            if ((pageSourceCheck.Contains("Are your friends already on Facebook?") && pageSourceCheck.Contains("Skip this step")) || pageSourceCheck.Contains("window.location.replace(\"http:\\/\\/www.facebook.com\\/gettingstarted.php"))
            {
                pageSrc1 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=classmates_coworkers");
                //}
                Thread.Sleep(300);
                //if (pageSrc1.Contains("Fill out your Profile Info") && pageSrc1.Contains("Skip"))
                //{
                pageSrc2 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=upload_profile_pic");
                Thread.Sleep(300);
                //}
                //if (pageSrc2.Contains("Set your profile picture") && pageSrc2.Contains("Skip"))
                //{
                pageSrc3 = Http.QuickGetStr("http://www.facebook.com/gettingstarted.php?step=summary");
                Thread.Sleep(300);
                //}

                ///Check if asks for email
                //If asks then Set Status as PhoneVerfiedOnly
                if (pageSrc3.Contains("complete the sign-up process"))
                {
                    PumpMessage("Account : " + Username + " is NOT Email verified");
                    InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                    return false;
                }
                else if (pageSourceCheck.Contains("please login to your email account below") || pageSourceCheck.Contains("Go to your email"))
                {
                    PumpMessage("Account : " + Username + " is NOT Email verified");
                    InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                    return false;
                }
            }

            ///Means NOT Email verified
            //Check if asks for email
            //If asks then Set Status as PhoneVerfiedOnly
            if (pageSourceCheck.Contains("complete the sign-up process"))
            {
                PumpMessage("Account : " + Username + " is NOT Email verified");
                InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                return false;
            }
            else if (pageSourceCheck.Contains("window.location.replace(\"http:\\/\\/www.facebook.com\\/confirmemail.php"))
            {
                PumpMessage("Account : " + Username + " is NOT Email verified");
                InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                return false;
            }
            else if (pageSourceCheck.Contains("please login to your email account below") || pageSourceCheck.Contains("Go to your email"))
            {
                PumpMessage("Account : " + Username + " is NOT Email verified");
                InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhoneVerfiedOnly));
                return false;
            }

            #endregion
            //** FB Account Check email varified or not ***********************************************************************************//

            PumpMessage("Account : " + Username + " is Email & Phone verified");
            InsertUpdateDatabase(AccountStatus.Status(ProfileStatus.PhonePlusEmailVerified));
            return true;

        }
示例#9
0
        public string GetHtmlProxy(string URL, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref Chilkat.Http http)
        {
            string response = string.Empty;

            this.proxyAddress = proxyAddress;
            this.proxyPort = proxyPort;
            this.proxyUsername = proxyUsername;
            this.proxyPassword = proxyPassword;

            ChangeProxy();

            if (!http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"))
            {
            }

            ///Save Cookies...
            http.CookieDir = "memory";
            http.SendCookies = true;
            http.SaveCookies = true;

            http.SetRequestHeader("Accept-Encoding", "gzip,deflate");
            http.SetRequestHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
            http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36");
            http.SetRequestHeader("Accept", "application/json, text/javascript, */*; q=0.01");
            http.SetRequestHeader("Accept-Language", "en-US,en;q=0.8");

            //http.SetRequestHeader("Accept-Encoding", "gzip,deflate");
            //http.SetRequestHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
            //http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24");
            //http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");

            response = http.QuickGetStr(URL);

            return response;
        }
示例#10
0
        public bool Hotmails(string Email, string Password, ref Chilkat.Http http1)
        {
            bool activate = false;
            Chilkat.Http http = http1;
            GlobusHttpHelper HttpHelper = new GlobusHttpHelper();
            #region Hotmail
            if (Email.Contains("@hotmail"))
            {
                if (popClient.Connected)
                    popClient.Disconnect();
                popClient.Connect("pop3.live.com", int.Parse("995"), true);
                popClient.Authenticate(Email, Password);
                int Count = popClient.GetMessageCount();

                for (int i = Count; i >= 1; i--)
                {
                    OpenPOP.MIME.Message Message = popClient.GetMessage(i);
                    string subject = string.Empty;
                    subject = Message.Headers.Subject;

                    if (Message.Headers.Subject.Contains("[WordPress] Activate") && Message.Headers.Subject.Contains("wordpress.com"))
                    {
                        foreach (string href in GetUrlsFromStringHotmail(Message.MessageBody[0]))
                        {
                            try
                            {
                                string staticUrl = string.Empty;
                                staticUrl = href;

                                responce = http.QuickGetStr(staticUrl);
                                if (responce.Contains("Your account is now active"))
                                {
                                    Log("Account activated");
                                    activate = true;
                                }
                            }
                            catch (Exception ex)
                            {

                            }
                        }
                    }
                }
            }
            #endregion
            return activate;
        }
示例#11
0
        public string GetHtmlProxy(string URL, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, ref Chilkat.Http http)
        {
            string response = string.Empty;

            this.proxyAddress = proxyAddress;
            this.proxyPort = proxyPort;
            this.proxyUsername = proxyUsername;
            this.proxyPassword = proxyPassword;

            ChangeProxy();

            response = http.QuickGetStr(URL);

            return response;
        }
示例#12
0
        private IFile ExtractAttributedFile(Chilkat.ZipEntry zipEntry, string path)
        {
            if (!zipEntry.Extract(path))
            {
                throw new Exception(String.Format("Failed to extract the zip entry {0} to {1} ", zipEntry.FileName, path));
            }

            var fileName = Path.Combine(path, zipEntry.FileName);
            if (!System.IO.File.Exists(fileName) && !System.IO.Directory.Exists(fileName))
            {
                throw new Exception("Failed to extract zip entry. Failed to create disk file: " + fileName);
            }

            System.IO.FileAttributes attributes = System.IO.File.GetAttributes(fileName);
            if ((attributes & System.IO.FileAttributes.ReadOnly) == System.IO.FileAttributes.ReadOnly)
            {
                System.IO.File.SetAttributes(fileName, attributes & ~System.IO.FileAttributes.ReadOnly);
            }
            
            IFile file = new File(fileName, zipEntry.FileName, Guid.NewGuid().ToString());
            if (file == null)
            {
                throw new Exception("Failed to extract zip entry. Failed to create IFile object.");
            }

            if ((attributes & System.IO.FileAttributes.ReadOnly) == System.IO.FileAttributes.ReadOnly)
            {
                Logger.LogInfo("Setting the ReadOnly property: " + fileName);
                file.WasReadOnly = true;
            }

            Logger.LogInfo(String.Format("Extracted zip entry {0} to file {1}", zipEntry.FileName, fileName));
            return file;
        }
示例#13
0
        private IFile CreateFileFromContent(Chilkat.ZipEntry zipEntry, string fileName)
        {
            byte[] entryData = zipEntry.Inflate();
            if (entryData == null || (entryData.Length == 0 && !IsZeroLengthFile(zipEntry)))
            {
                throw new Exception("Failed to extract zip entry. Failed to retrieve content.");
            }

            using (FileStream fileStream = new FileStream(fileName, FileMode.Create))
            {
                for (int i = 0; i < entryData.Length; i++)
                {
                    fileStream.WriteByte(entryData[i]);
                }
            }

            if (!System.IO.File.Exists(fileName))
            {
                throw new Exception("Failed to extract zip entry. Failed to create disk file.");
            }

            // In ZipCompressor.PackContainer we set the part of the path to be ignored for the new ZipEntry (ZipCompressor.cd Ln 97). 
            // To calculate the part to be ignored we remove the display name from the file name. This would fail if we changed the 
            // file name to a short file name. We set the display name to the short file name but retain any folders prepended to the dispay name.
            var displayName = Path.Combine(Path.GetDirectoryName(zipEntry.FileName), Path.GetFileName(fileName));
            Logger.LogInfo(String.Format("Change display name from {0} to {1}", zipEntry.FileName, displayName));

            IFile file = new File(fileName, displayName, Guid.NewGuid().ToString());
            if(file == null)
            {
                throw new Exception("Failed to extract zip entry. Failed to create IFile object.");
            }

            Logger.LogInfo(String.Format("Extracted zip entry {0} to file {1}", zipEntry.FileName, fileName));
            return file;
        }
示例#14
0
		private bool IsZeroLengthFile(Chilkat.ZipEntry zipEntry)
		{
			return zipEntry.UncompressedLength == 0;
		}
示例#15
0
		private static List<string> GetBccRecipientsFromObject(Chilkat.Email email)
		{
			if (email == null || email.NumBcc < 1)
			{
				return new List<string>();
			}

			int numBcc = email.NumBcc;
			List<string> recipientList = new List<string>(numBcc);
			for (int index = 0; index < numBcc; ++index)
			{
				StringBuilder recipient = new StringBuilder();

				string displayName = email.GetBccName(index);
				if (!string.IsNullOrEmpty(displayName))
				{
					recipient.Append("\"");
					recipient.Append(displayName);
					recipient.Append("\" ");
				}

				string emailAddress = email.GetBccAddr(index);
				recipient.Append("<");
				recipient.Append(emailAddress);
				recipient.Append(">");

				recipientList.Add(recipient.ToString());
			}

			return recipientList;
		}
示例#16
0
        public static void RequestJSCSSIMG(string pageSource, ref Chilkat.Http http)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

            List<string> listURLs = new List<string>();

            ChilkatHttpHelpr HttpHelper = new ChilkatHttpHelpr();
           

            //CSS Request
            foreach (string item in GetHrefsFromString(pageSource))
            {
                if (item.Contains(".css"))
                {
                    string cssSource = item.Replace(" ", "").Trim();
                    try
                    {
                        //string res = HttpHelper.GetHtmlProxy(cssSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        listURLs.Add(cssSource);
                    }
                    catch (Exception)
                    {
                        Thread.Sleep(500);
                        try
                        {
                            string res = HttpHelper.GetHtmlProxy(cssSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }

            //JS Request
            string[] scriptArr = Regex.Split(pageSource, "/script>");
            foreach (string item in scriptArr)
            {
                try
                {
                    if (item.Contains("static.ak.") || item.Contains("profile.ak."))
                    {
                        int startIndx = item.LastIndexOf("src=") + "src=".Length + 1;
                        int endIndx = item.IndexOf(">", startIndx) - 1;
                        string jsSource = item.Substring(startIndx, endIndx - startIndx);
                        //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak."))
                        if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak."))
                        {
                            try
                            {
                                //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                listURLs.Add(jsSource);
                            }
                            catch (Exception)
                            {
                                Thread.Sleep(500);
                                try
                                {
                                    string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }

            string[] moreScriptArray = Regex.Split(pageSource, "\"src\":");
            foreach (string item in moreScriptArray)
            {
                try
                {
                    int startIndx = 1;
                    int endIndx = item.IndexOf("\"", startIndx);
                    string jsSource = item.Substring(startIndx, endIndx - startIndx).Replace("\\", "");
                    if (jsSource.Contains(".js"))
                    {
                        //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                        listURLs.Add(jsSource);
                    }
                }
                catch (Exception)
                {
                }
            }

            ///IMG Request
            string[] imageArr = Regex.Split(pageSource, "<img");
            foreach (string item in imageArr)
            {
                try
                {
                    if (item.Contains("static.ak.") || item.Contains("profile.ak."))
                    {
                        int startIndx = item.IndexOf("src=") + "src=".Length + 1;
                        int endIndx = item.IndexOf("\"", startIndx + 1);
                        string jsSource = item.Substring(startIndx, endIndx - startIndx);
                        //if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak."))
                        if (jsSource.StartsWith("http://static.ak.") || jsSource.StartsWith("https://static.ak.") || jsSource.StartsWith("http://s-static.ak.") || jsSource.StartsWith("https://s-static.ak.") || jsSource.StartsWith("http://profile.ak.") || jsSource.StartsWith("https://profile.ak.") || jsSource.StartsWith("http://s-profile.ak.") || jsSource.StartsWith("https://s-profile.ak."))
                        {
                            if (jsSource.Contains(".png") || jsSource.Contains(".gif") || jsSource.Contains(".jpg") || jsSource.Contains(".jpeg"))
                            {
                                try
                                {
                                    //string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                    listURLs.Add(jsSource);
                                }
                                catch (Exception)
                                {
                                    Thread.Sleep(500);
                                    try
                                    {
                                        string res = HttpHelper.GetHtmlProxy(jsSource, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);// HttpHelper.getHtmlfromUrl(new Uri(cssSource));
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                catch { };
            }

            listURLs = listURLs.Distinct().ToList();
            foreach (string item in listURLs)
            {
                try
                {
                    string res = HttpHelper.GetHtmlProxy(item, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref http);
                }
                catch { };
            }

        }
        public string GetHtml(string URL, ref Chilkat.Http http)
        {
            string response = string.Empty;

            ChangeProxy();

            ChangeProxy_Socks5();

            if (!http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"))
            {
            }

            ///Save Cookies...
            http.CookieDir = "memory";
            //http.CookieDir = Application.StartupPath + "\\cookies";
            http.SendCookies = true;
            http.SaveCookies = true;

            http.SetRequestHeader("Accept-Encoding", "gzip,deflate");
            http.SetRequestHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7;Unicode;");
            http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24");
            http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");

            //http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
            //http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
            http.SetRequestHeader("Connection", "keep-alive");

            http.AllowGzip = true;

            response = http.QuickGetStr(URL);

            //if (string.IsNullOrEmpty(response))
            //{
            //    Thread.Sleep(500);
            //    response = http.QuickGetStr(URL);
            //}
            if (string.IsNullOrEmpty(response))
            {
                Thread.Sleep(500);
                response = http.QuickGetStr(URL);
            }

            return response;
        }
        public string GetHtmlProxy_JSCSS(string URL, string proxyAddress, string proxyPort, string proxyUsername, string proxyPassword, string referer, ref Chilkat.Http http)
        {
            string response = string.Empty;

            this.proxyAddress = proxyAddress;
            this.proxyPort = proxyPort;
            this.proxyUsername = proxyUsername;
            this.proxyPassword = proxyPassword;

            ChangeProxy();
            ChangeProxy_Socks5();

            if (!http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"))
            {
            }

            ///Save Cookies...
            http.CookieDir = "memory";
            http.SendCookies = false;
            http.SaveCookies = true;

            http.SetRequestHeader("Accept-Encoding", "gzip,deflate");
            http.SetRequestHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
            http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24");
            http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");

            response = http.QuickGetStr(URL);

            if (string.IsNullOrEmpty(response))
            {
                Thread.Sleep(500);
                response = http.QuickGetStr(URL);
            }
            if (string.IsNullOrEmpty(response))
            {
                Thread.Sleep(500);
                response = http.QuickGetStr(URL);
            }

            return response;
        }
示例#19
0
        public List<string> ExtractFriendIDs(ref BaseLib.ChilkatHttpHelpr HttpHelper, ref Chilkat.Http http, ref string userID)
        {
            try
            {
                string pgSrc_HomePage = HttpHelper.GetHtml("http://www.facebook.com/", ref http);
                string ProFileURL = string.Empty;

                string UserId = string.Empty;

                #region Get User or Account ID
                if (pgSrc_HomePage.Contains("http://www.facebook.com/profile.php?id="))
                {
                    ///Modified Sumit [10-12-2011]
                    #region

                    int startIndx = pgSrc_HomePage.IndexOf("http://www.facebook.com/profile.php?id=");
                    int endIndx = pgSrc_HomePage.IndexOf("\"", startIndx + 1);
                    ProFileURL = pgSrc_HomePage.Substring(startIndx, endIndx - startIndx);
                    if (ProFileURL.Contains("&"))
                    {
                        string[] Arr = ProFileURL.Split('&');
                        ProFileURL = Arr[0];
                    }

                    #endregion
                }
                if (ProFileURL.Contains("http://www.facebook.com/profile.php?id="))
                {
                    UserId = ProFileURL.Replace("http://www.facebook.com/profile.php?id=", "");
                    if (UserId.Contains("&"))
                    {
                        UserId = UserId.Remove(UserId.IndexOf("&"));
                    }
                    userID = UserId;
                } 
                #endregion

                List<string> lstFriend = new List<string>();
                string pgSrc_FriendsPage = HttpHelper.GetHtml("http://www.facebook.com/profile.php?id=" + UserId + "&sk=friends&v=friends", ref http);
                if (pgSrc_FriendsPage.Contains("http://www.facebook.com/profile.php?id="))
                {
                    string[] arr = Regex.Split(pgSrc_FriendsPage, "href");
                    foreach (string strhref in arr)
                    {
                        if (!strhref.Contains("<!DOCTYPE"))
                        {
                            if (strhref.Contains("profile.php?id"))
                            {
                                int startIndx = strhref.IndexOf("profile.php?id") + "profile.php?id".Length + 1;
                                int endIndx = strhref.IndexOf("\"", startIndx);

                                string profileID = strhref.Substring(startIndx, endIndx - startIndx);

                                if (profileID.Contains("&"))
                                {
                                    profileID = profileID.Remove(profileID.IndexOf("&"));
                                }
                                if (profileID.Contains("\\"))
                                {
                                    profileID = profileID.Replace("\\", "");
                                }
                                lstFriend.Add(profileID);
                            }
                        }
                    }
                }
                List<string> itemId = lstFriend.Distinct().ToList();
                return itemId;
            }
            catch (Exception)
            {
                return null;
            }
        }
示例#20
0
        public string GetHtmlIP(string URL, string IPAddress, string IPPort, string IPUsername, string IPpassword, ref Chilkat.Http http)
        {
            string response = string.Empty;

            this.IPAddress = IPAddress;
            this.IPPort = IPPort;
            this.IPUsername = IPUsername;
            this.IPpassword = IPpassword;

            ChangeIP();

            if (!http.UnlockComponent("THEBACHttp_b3C9o9QvZQ06"))
            {
            }

            ///Save Cookies...
            http.CookieDir = "memory";
            http.SendCookies = true;
            http.SaveCookies = true;

            http.SetRequestHeader("Accept-Encoding", "gzip,deflate");
            http.SetRequestHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
            http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24");
            http.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");

            response = http.QuickGetStr(URL);

            return response;
        }