I wants some data of My Facebook Account but it not allowing me?
Posted
by Pankaj Mishra
on Stack Overflow
See other posts from Stack Overflow
or by Pankaj Mishra
Published on 2010-04-01T22:46:47Z
Indexed on
2010/04/01
22:53 UTC
Read the original article
Hit count: 480
c#
I am using http://lite.facebook.com And i want to get some data from my account. I am using HttpWebRequest for this.
I am able to login to facebook from my credential using web request And I got profile url from home page html.
Now when i am trying to get list of all friends then its kick me out login page.
for login I am using This Code.
string HtmlData = httpHelper.getHtmlfromUrl(new Uri(FacebookUrls.Lite_MainpageUrl));
lstInput = globussRegex.GetInputControlsNameAndValueInPage(HtmlData);
foreach (string str in lstInput)
{
if (str.Contains("lsd"))
{
int FirstPoint = str.IndexOf("name=\"lsd\"");
if (FirstPoint > 0)
{
TempHtmlData = str.Substring(FirstPoint).Replace("name=\"lsd\"","").Replace("value","");
}
int SecondPoint = TempHtmlData.IndexOf("/>");
if (SecondPoint > 0)
{
Value = TempHtmlData.Substring(0, SecondPoint).Replace("=", "").Replace("\\", "").Replace("\"", "").Replace(" ", "");
}
}
}
string LoginData = "form_present=1&lsd=" + Value + "&email=" + UserName + "&password=" + Password + "";
string ResponseData = httpHelper.postFormData(new Uri(FacebookUrls.Lite_LoginUrl), LoginData);
int FirstProfileTag = ResponseData.IndexOf("/p/");
int SecondProfileTag = ResponseData.IndexOf("\">Profile");
if (FirstProfileTag > 0 && SecondProfileTag > 0)
{
string TempProfileUrl = ResponseData.Substring(FirstProfileTag, SecondProfileTag - FirstProfileTag);
string ProfileUrl = FacebookUrls.Lite_ProfileUrl + TempProfileUrl;
GetUserProfileData(ProfileUrl);
}
And For getting Profile Url And FriendList Url Iam doing This
string HtmlData = httpHelper.getHtmlfromUrl(new Uri(ProfileUrl));
string FriendUrl = "http://lite.facebook.com" + "/p/Pankaj-Mishra/1187787295/friends/";
string HtmlData1 = httpHelper.getHtmlfromUrl(new Uri(FriendUrl));
I got perfect result when i tried for ProfileUrl. but when i tried for frindUrl its logged out how can i solve this problem Plz help me.
© Stack Overflow or respective owner