Page 1 of 4 123 ... LastLast
Results 1 to 15 of 46
  1. #1
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused

    Question [Help]# Posts in a forum[solved]

    Basically, I want to find the number of posts on mpgh and display it as a label.text.

    For example my user profile is here:
    https://www.mpgh.net/forum/members/378727-ppl2pass.html

    And right now i have 209 posts.

    Basically, the program will read the source of that page and find this line:
    Code:
    Total Posts:</span> 209</li>
    But this will be different for everyone.
    How would i display the number of post in a label for different users.

  2. #2
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    What website is it, if it has a ID super Easy, if not, I will work something out.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  3. #3
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    NextGen1 Edit:
    Namespace
    [php]
    Imports System.Net
    Imports System.IO
    Imports System.Text.RegularExpressions
    [/php]

    Code:
     Dim Request As HttpWebRequest = HttpWebRequest.Create("https://www.mpgh.net/forum/members/378727-ppl2pass.html")
            Dim Response As HttpWebResponse = Request.GetResponse()
            Dim reader As StreamReader = New StreamReader(Response.GetResponseStream)
            Dim httpContent As String
            httpContent = reader.ReadToEnd
    
            Dim ViewRegEx As New Regex("Total Posts:</span>(?<Views>(.*))</li>")
            Dim Views As String
            Views = (Mid$(ViewRegEx.Match(httpContent).Groups("Views").ToString, 1, 46))
    
    
           label1.text = Views.Replace("</li> <li><span class=""shade"">Posts Per Da", "")
    This should get you the posts of a certain member...
    Last edited by NextGen1; 04-18-2010 at 06:39 AM.



  4. The Following User Says Thank You to Blubb1337 For This Useful Post:

    ppl2pass (04-18-2010)

  5. #4
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused
    how would you get it for different members, not only for me.

    what could i replace for this.
    MPGH - MultiPlayer Game Hacking - View Profile: ppl2pass

  6. #5
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    added the namespace, and yes it is A-typical Context reader with Http and XML
    Still would like the site, the reason I asked is content will be different, and I don't think it is for mpgh.

    @blubb, Good Job

    @ppl ,
    Ok it is for mpgh , You will need their address link. in this example, short of database access , you won't have that information (unless you use PHP and post , but that's asp.net)

    Best bet is to allow the user during setup to add their url



    Last edited by NextGen1; 04-18-2010 at 06:50 AM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  7. #6
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused
    i have a good idea.

    to make this happen, i will use a webbrowser in vb.net
    i will then tell people to login on the webbrowser.
    after they login i will take the source of the webpage and find this line:
    Code:
    <strong>Welcome, <a href="https://www.mpgh.net/forum/members/378727-ppl2pass.html">ppl2pass</a>
    will this work?

  8. #7
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108



  9. #8
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Exactly PPL, that should work fine

    at blubb


     


     


     



    The Most complete application MPGH will ever offer - 68%




  10. #9
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused
    at NextGen1 or Blubb

    would you explain this code as i will try this for the welcome one.

    Code:
            Dim ViewRegEx As New Regex("Total Posts:</span>(?<Views>(.*))</li>")
            Dim Views As String
            Views = (Mid$(ViewRegEx.Match(httpContent).Groups("Views").ToString, 1, 46))
    
    
           label1.text = Views.Replace("</li> <li><span class=""shade"">Posts Per Da", "")
    espcially this:
    Code:
    (?<Views>(.*))
    how do you know this?

  11. #10
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    You can change "(?<Views>(.*))" to whatever you want.

    The "(.*)" tells the program, that the string of "Views" can have any length, since we don't what the length is. It can be 4 numbers but also 8. You don't know.

    The "?" tells the program, that it should extract the variable between the <> in this case "Views".

    In this line of code Regex is started("Views = (Mid$(ViewRegEx.Match(httpContent).Groups("Views") .ToString, 1, 46))")

    httpcontent = the text to be searched in...

    Views = The variable the amount of views is saved in...

    Mid$ extracts a lot of crap. Without mid$ you'd get a lot of other code as result. It basically extract all characters whose are not in the area from 1-46.


    Sorry for this crappy English. I have no idea how to say it =P

    In computing, regular expressions, also referred to as regex or regexp, provide a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. A regular expression is written in a formal language that can be interpreted by a regular expression processor, a program that either serves as a parser generator or examines text and identifies parts that match the provided specification.



  12. The Following User Says Thank You to Blubb1337 For This Useful Post:

    ppl2pass (04-18-2010)

  13. #11
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused
    ok ty. i got one more question.
    how would you view the page source of a webbrowser?

  14. #12
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Code:
    dim source as string = webbrowser1.documenttext
    to make sure the webbrowser is loaded use the following code:

    Code:
    While not webbrowser1.readystate = readystate.completed 
    application.doevents
    end with
    readystate.completed is prolly written somehow else, you'll see....



  15. The Following User Says Thank You to Blubb1337 For This Useful Post:

    ppl2pass (04-18-2010)

  16. #13
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused
    this functoin doesnt work.

    While not webbrowser1.readystate = readystate.completed
    application.doevents
    end with

    readstate.completed not defined.

    also how do you get the url of webbrower1.
    Last edited by ppl2pass; 04-18-2010 at 09:38 AM.

  17. #14
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused
    how would you be able to find and read this url for each user:

    Code:
    https://www.mpgh.net/forum/members/378727-ppl2pass.html">ppl2pass
    Code:
    <strong>Welcome, <a href="https://www.mpgh.net/forum/members/378727-ppl2pass.html">ppl2pass</a>.</strong>

  18. #15
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Quote Originally Posted by ppl2pass View Post
    this functoin doesnt work.

    While not webbrowser1.readystate = readystate.completed
    application.doevents
    end with

    readstate.completed not defined.

    also how do you get the url of webbrower1.
    [php]
    Dim source As String = WebBrowser1.DocumentText

    While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
    Application.DoEvents()
    End While
    [/php]


     


     


     



    The Most complete application MPGH will ever offer - 68%




Page 1 of 4 123 ... LastLast

Similar Threads

  1. [SOLVED][Help]Posting
    By soccerguy in forum Call of Duty Modern Warfare 2 Help
    Replies: 14
    Last Post: 08-01-2010, 06:33 AM
  2. :O are we allowed to double post in this forum?
    By Kevin Rudd in forum Spammers Corner
    Replies: 3
    Last Post: 12-20-2009, 12:37 AM
  3. need some help posting
    By minista365 in forum CrossFire Hacks & Cheats
    Replies: 2
    Last Post: 11-29-2009, 11:38 PM
  4. [Help] Can't post on z8 forums.
    By Ricky1337 in forum CrossFire Hacks & Cheats
    Replies: 20
    Last Post: 10-19-2009, 02:48 AM
  5. [ROFL] Look What Some Oober Noob posted on nexon forums XD
    By willdill42 in forum Combat Arms Hacks & Cheats
    Replies: 20
    Last Post: 08-12-2008, 04:24 PM