VB.NET HELP[REP+]
#1

Hey guys, I need some help here . I trying to make custom launcher and try to get my server status from SACNR API . The text was mess . How can i extract that text from this site without mess ? Example: http://monitor.sacnr.com/api/?IP=139...77&Action=info Sorry for my bad english
Reply
#2

Use inspect element.
Reply
#3

#edit

****** about unserialize, i don't know much about it but i found it nearly similar.

example:
http://www.unserialize.com/s/001dee6...e-00003bb18f2e
Reply
#4

That kind of object can't be used in .NET AFAIK.
Reply
#5

Add the format parameter in URL to get output as a JSON object, use this link :
Then use any suitable JSON object handler library to decode.
Reply
#6

Best JSON library for .NET is JSON.Net
Reply
#7

Broo... How Can I Parse With JSON ?

Like This?
PHP код:
        Dim web As New Net.WebClient
        Dim r 
As String "http://monitor.sacnr.com/api/?IP=139.59.240.9&Port=7777&Action=info&Format=JSON"
        
Dim reader As StreamReader = New StreamReader(web.OpenRead(r))
        
JsonConvert.DeserializeObject(Of ArrayList)(reader.ReadToEnd
Reply
#8

To deserialize a JSON string you have to use JObject.parse.

PHP код:
Imports System.IO
Imports Newtonsoft
.Json
Imports Newtonsoft
.Json.Linq
Imports System
.Net
Module Module1
    Sub Main
()
        
Dim web As New WebClient
        Dim reader 
As StreamReader = New StreamReader(web.OpenRead("http://monitor.sacnr.com/api/?IP=139.59.240.9&Port=7777&Action=info&Format=JSON"))
        
Dim jData As JObject JObject.Parse(reader.ReadToEnd)
        
Console.WriteLine(jData("Hostname").ToString "   " jData("Gamemode").ToString)
        
Console.ReadLine()
    
End Sub
End Module 
Use jData("keyname") to retrieve any info from the JSON string.
Reply
#9

Thx!!! It Work Properly ! REP+ ALL
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)