![]() |
|
Tutorial Getting data from web? - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework) +--- Thread: Tutorial Getting data from web? (/Thread-Tutorial-Getting-data-from-web) |
Getting data from web? - Villain - 08-12-2013 Hey everyone, I currently am making a program which checks your pm's on a site. Atm, it just has login system, which does work through web request. But I was wondering, how can I make it so I can check pm's on the site, like how can I make a button check for the text " You have X number of private messages etc, also how can I make it so if it says 1 message, or 2 message etc, a label says how many too? Thanks. RE: Getting data from web? - Xanii - 08-12-2013 You would need to do a login request, then scan the page by either using REGEX or SPLIT, find Private Messages (Unread X, Total Y), then you would need to parse out the UNREAD X variable. RE: Getting data from web? - Villain - 08-12-2013 (08-12-2013, 07:57 PM)Xanii Wrote: You would need to do a login request, then scan the page by either using REGEX or SPLIT, find Private Messages (Unread X, Total Y), then you would need to parse out the UNREAD X variable. I have login, that works fine atm, also what are REGEX/SPLIT? Are they external programs?
RE: Getting data from web? - Eternity - 08-12-2013 (08-12-2013, 07:58 PM)Villain Wrote:(08-12-2013, 07:57 PM)Xanii Wrote: You would need to do a login request, then scan the page by either using REGEX or SPLIT, find Private Messages (Unread X, Total Y), then you would need to parse out the UNREAD X variable. No, they are libraries built-in to the .NET framework. Essentially what they do is parse text to give you for example what xanii told you, an variable. Google them up. RE: Getting data from web? - Madara-Uchiha - 08-12-2013 Use Httpwebrequest / response to get the sites sourcecode and filter the read/unread messages by Regex. Then Display the numbers e.g. in a label. Done. RE: Getting data from web? - Shebang - 08-14-2013 [code=vbnet]'WebClient Example Dim W As New WebClient Dim source As String = W.DownloadString("http://www.codecommunity.net/") Dim TotalUnread As String = Split(source, "(Unread ")(1).Split(",")(0)[/code] Re: RE: Getting data from web? - Eternity - 08-14-2013 (08-14-2013, 05:22 PM)shebang Wrote: [code=vbnet]'WebClient Example Didn't know it was that easy o.O - sent from android RE: Getting data from web? - Shebang - 08-14-2013 (08-14-2013, 05:24 PM)Eternity Wrote:(08-14-2013, 05:22 PM)shebang Wrote: [code=vbnet]'WebClient Example Split isn't hard to use Apparently some people have a lot of issues with it.
RE: Getting data from web? - Villain - 08-15-2013 (08-14-2013, 05:22 PM)shebang Wrote: [code=vbnet]'WebClient Example So, do I put that code onto a button? Also, how would I make the results show on a label? RE: Getting data from web? - Shebang - 08-15-2013 (08-15-2013, 03:04 PM)Villain Wrote:(08-14-2013, 05:22 PM)shebang Wrote: [code=vbnet]'WebClient Example Yes, just put it on a button. [code=vbnet]Label1.Text = "You have " & TotalUnread & " unread messages."[/code] |