1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating a Facebook Fanpage switcher... need advice.

Discussion in 'Visual Basic .NET' started by spiritmolecule, Oct 8, 2013.

  1. spiritmolecule

    spiritmolecule Registered Member

    Joined:
    Oct 31, 2008
    Messages:
    62
    Likes Received:
    15
    Hey,

    So, I'm trying to put together this windows form application that enables me to switch fan page profiles in a single facebook account, on the fly.

    [​IMG]

    So basically, I want my software to do the same function as shown above ^, by clicking a button on the windows form. I want this button to switch my profile to the "next" fan page in the list. In other words, I want to be able to switch fanpages, in an orderly fashion, at the click of a button in my app.

    So far, I've managed to figure out how to perform the "switch profile" function using an html "form post" in a rich text box. It looks like this....

    [​IMG]

    I use webbrowser2.document.write(richtextbox1.text) to write this code into a new browser, and click the form button. When I do so, the profile switches, successfully. Everything up until this point is functioning exactly how I want it.

    Now, What I want to do next, has me stumped. I should let you know that I have very limited knowledge of VB, and am basically writing this code based on what I learn from online tutorials and forum threads I find on google.

    What I want to do now is have my bot scrape all of the relevant values from the fan pages in the webbrowser document text, and put them into an ordered table that I can then use to update the "html form post" code in the text box, when I click the "next profile" button.

    The HTML code for each profile, in the document text, looks like this...

    HTML:
    <input type="hidden" name="fb_dtsg" value="AQAej0vt" autocomplete="off"><input type="hidden" name="user_id" value="224461581049959"><input type="hidden" name="url" value="https://www.facebook.com/pages/Bleh-Blah/224461581049959?ref=hl"></form><a class="navSubmenu" id="navSubmenuPageLink_224461581049959" onclick="$("u_0_e").submit()" href="#" role="button"><div class="clearfix"><img class="mrs _s0 _8o lfloat _ry img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c14.0.47.47/s24x24/399548_10149999285987789_1102888142_t.png" alt=""><div class="clearfix _42ef"><span class="count mls rfloat hidden_elem uiSideNavCount uiSideNavCountInline"><span class="countValue fss">0</span></span><div class="navSubmenuName ellipsis">Bleh Blah</div></div></div></a></li><li role="menuitem">
    I'm assuming this will involve regular expressions, but i'm not quite sure where to start with this in vb.net... Hopefully that makes sense.

    Any kind of kick in the right direction would be much appreciated!
     
  2. masush300

    masush300 Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 16, 2012
    Messages:
    1,019
    Likes Received:
    333
    Occupation:
    Coding
    Location:
    Imagine Dragons
    Home Page:
    Code:
       foreach (HtmlElement elm in webBrowser1.Document.All)
    {
            if (elm.GetAttribute("className") == "navSubmenuName ellipsis")
            {
                elm.InvokeMember("click"); //clicks ur page one by one
     //timer or wait event and do others things...
            }
    }
    
    Havnt tested ,But thats just an idea
    PS : Its c#
     
    • Thanks Thanks x 1