communicating with facebook problem
Hi,
I'm trying to collect facebook user IDs from a page using webbrowser control in c#, the problem is that it always collects the same amount of users although there are more on that page. What I actually do is scan the source code for "user.php?id=" and perform a substring to take out the user id and name but I found out that not all the users appear in the page source. and the second problem is that when I collect user IDs it always gets me the same users even when I browse other pages, only when I use webbrowser.navigate(); it changes, anyone knows how to make it update itself automatically or smth else?
this is the code that I used to collect the user IDs:
Code: (I know it's not the BEST but take it easy on me im kinda new)
private void button1_Click_1(object sender, EventArgs e)
{
string MainString = webBrowser1.DocumentText;
string SrchStrId = "user.php?id=";
string SrchStrIdE = "\"";
string SrchStrName = "\">";
string SrchStrNameE = "<";
string strId;
string strName;
int FirstChr;
int EndChr;
ArrayList idList = new ArrayList();
ArrayList NameList = new ArrayList();
ArrayList boxlist = new ArrayList();
while (MainString.IndexOf(SrchStrId) > -1)
{
FirstChr = MainString.IndexOf(SrchStrId);
MainString = MainString.Substring(FirstChr);
EndChr = MainString.IndexOf(SrchStrIdE);
strId = MainString.Substring(SrchStrId.Length, EndChr - SrchStrId.Length);
if(strId.EndsWith("\\"))
{
strId=strId.Remove(strId.Length - 1, 1);
}
strName = MainString;
FirstChr = strName.IndexOf(SrchStrName);
EndChr = strName.IndexOf(SrchStrNameE);
strName = strName.Substring(FirstChr);
strName = strName.Substring(SrchStrName.Length, EndChr - FirstChr - SrchStrName.Length);
if(ifExist(idList, strId))
{
idList.Add(strId);
NameList.Add(strName);
boxlist.Add(string.Format("{0} = {1}", strId, strName));
}
MainString = MainString.Substring(EndChr + SrchStrIdE.Length);
}
list1.DataSource = null;
list1.DataSource = boxlist;
}
Re: communicating with facebook problem
Re: communicating with facebook problem
My first suggestion is that you should use Regular expression for this task, your method isn´t wrong but needs lots of code.
Re: communicating with facebook problem
If you're going to do something, go about it the right way ;)
http://developers.facebook.com/
Re: communicating with facebook problem
zeokat, the problem is that not all the users appear in the source code.. so I dunno how to scan the page in order to get more
mutant fruit, that's cheating! im tryna do it in my way
Re: communicating with facebook problem
Quote:
Originally Posted by
CoNfideNce
mutant fruit, that's cheating! im tryna do it in my way
cheating?! LoooooooL then using .NET is cheating as well, with your mindset you should use the WinAPI directly or still better Assembler because even C would be cheating. you seem to like wasting your time. they made the API to make life easier but you prefer to do it the hard way and reinvent the wheel, whatever, have fun :p
Re: communicating with facebook problem
Quote:
Originally Posted by
memeloo
cheating?! LoooooooL then using .NET is cheating as well, with your mindset you should use the WinAPI directly or still better Assembler because even C would be cheating. you seem to like wasting your time. they made the API to make life easier but you prefer to do it the hard way and reinvent the wheel, whatever, have fun :p
if i wanted to practice asm i wouldn't have built that
and that doesn't solve my question yet, please keep it relevant