Click here to Skip to main content
15,890,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I'm trying to post a message to my* facebook wall with using httpwebrequest.
First of all i should explain the project. winform has listbox which can split the usernames and passwords with character ":"
and a button to check all accounts if their situation are ok or not. i'm checking one by one with this code and it's working.

My problem is to send a message with using these accounts to their walls.
login check is ok, but after login check i cannot use again account list for sending message. i hope i could explain it.

ps : i do not want to use sdk,api or webBrowser.
thanks


ps 2 : in short, i have fb account list and i want to send a message to their walls with using httpwebrequest.

Thanks all.

LOGIN CONTROL CODE :
C#
bool flag = false;
            CookieContainer container = null;
            string s = "&email=" + ee+ "&pass=" + pp+ "";
            CookieContainer mycontainer2 = new CookieContainer();
            byte[] bytes = new UTF8Encoding().GetBytes(s);
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://m.facebook.com/login.php");
            request.Method = "POST";
            request.KeepAlive = true;
            request.CookieContainer = mycontainer2;
            request.ContentType = "application/x-www-form-urlencoded";
            request.Referer = "https://m.facebook.com/";
            request.UserAgent = byAgent;
            request.ContentLength = bytes.Length;
            request.GetRequestStream().Write(bytes, 0, bytes.Length);
            HttpWebResponse response = null;
            response = (HttpWebResponse)request.GetResponse();
            container2.Add(response.Cookies);
            container = mycontainer2;
            string str2 = new StreamReader(response.GetResponseStream()).ReadToEnd();
Posted
Comments
SundararamanS 10-Aug-15 8:37am    
If you don't want to use any API's then you have to do everything manually.. Understand what request is sent from your browser when you perform the same manually...literally speaking find the element on the page, insert the message and perform the click event automatically ..kind of simulation...

I found that you simply use cookie from facebook.com/ajax/bz then add params and send to server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900