Facebook帖子与HttpWebRequest帖子 [英] Facebook Posts with HttpWebRequest Post

查看:101
本文介绍了Facebook帖子与HttpWebRequest帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试使用httpwebrequest向我的* facebook墙发帖子。

首先,我应该解释一下这个项目。 winform有一个列表框,可以用:

分割用户名和密码,还有一个按钮,用于检查所有帐户是否正常。我正在逐一检查此代码并且它正在工作。



我的问题是发送一条消息,使用这些帐户到他们的墙上。

登录检查没问题,但登录后检查我不能再使用帐号列表发送邮件。我希望我能解释一下。



ps:我想要使用sdk,api或webBrowser。

谢谢





ps 2:简而言之,我有fb帐户列表,我想通过使用方式向他们的墙发送消息httpwebrequest。



全部谢谢。



登录管制代码:

< pre lang =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();

解决方案

请参阅此处的相同问题: http://stackoverflow.com/questions/8425593/c-sharp-httpwebrequest-post-login-to-facebook [ ^ ]


我发现你只需使用facebook.com/ajax/bz中的cookie然后添加params并发送到服务器。


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 :

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();

解决方案

Refer same issue here : http://stackoverflow.com/questions/8425593/c-sharp-httpwebrequest-post-login-to-facebook[^]


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


这篇关于Facebook帖子与HttpWebRequest帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆