-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: AboutShaily
Message 1 in Discussion

I am very new to writing a web-cralwer which programatically loging to 
a site.
My Requirements are: I need to browse the 
"http://mail.rediff.com/cgi-bin/login.cgi"; site daily to see if 
there is new Email present in my Inbox. I want to automate this whole 
process by writing a web crawler which will crawl these site,enter my 
login username and password then let me know if there is any new email. 
I started writing like below: 
 
Currently the way I am doing is : 
               private void login() 
                { 
                        HttpWebRequest req = 
(HttpWebRequest)WebRequest.Create("http://mail.rediff.com/cgi-bin/login.cgi";); 
                        req.Method = "Post"; 
                         string s = "login=shaily 
                         req.CookieContainer = new CookieContainer(); 
                         req.ContentType = "application/x-www-form-urlencoded"; 
                        //Set the POST data in a buffer 
                         byte[] PostBuffer = 
Encoding.GetEncoding(1252).GetBytes(s); 
                        //Specify the length of the buffer 
                         req.ContentLength = PostBuffer.Length; 
                        //Open up a request stream 
                         Stream RequestStream = req.GetRequestStream(); 
                         //Write the POST data 
                         RequestStream.Write(PostBuffer, 0, PostBuffer.Length); 
                         //Close the stream 
                         RequestStream.Close(); 

                        //Create the Response object 
                         HttpWebResponse Response = 
(HttpWebResponse)req.GetResponse(); 
                         //Create the reader for the response 
                         StreamReader sr = new 
StreamReader(Response.GetResponseStream(),Encoding.GetEncoding(1252)); 
                        //Read the response 
                         string t = sr.ReadToEnd(); 
                         //Close the reader, and response 
                         sr.Close(); 
                         Response.Close(); 
                        MessageBox.Show(t); 
                        CreateFile(t,"c:\\Changelog"); 
                } 
private void CreateFile(string buffer,string filename) 
                { 
                        StreamWriter outStream = new StreamWriter( filename ); 
                        outStream.Write(buffer); 
                        outStream.Close(); 
                } 


Problem: The respond which I am getting does not show me the inbox of 
mine where I can check the number of new mails. It seems to me that it 
is not posting the data to a form properly. Am I doing something wrong? 
What should I do to "login to my inbox" and retrieve the different 
values from there(E.g no of new mails, Total number of mails in inbox ) 


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to