SA-MP Forums Archive
VB.NET HELP[REP+] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: VB.NET HELP[REP+] (/showthread.php?tid=610850)



VB.NET HELP[REP+] - dh240473 - 29.06.2016

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


Re: VB.NET HELP[REP+] - Owen007 - 29.06.2016

Use inspect element.


Re: VB.NET HELP[REP+] - RaeF - 29.06.2016

#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


Re: VB.NET HELP[REP+] - iKarim - 29.06.2016

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


Re: VB.NET HELP[REP+] - BroZeus - 29.06.2016

Add the format parameter in URL to get output as a JSON object, use this link :
Quote:
http://monitor.sacnr.com/api/?IP=139.59.240.9&Port=7777&Action=info&Format=JSON
Then use any suitable JSON object handler library to decode.


Re: VB.NET HELP[REP+] - iKarim - 29.06.2016

Best JSON library for .NET is JSON.Net


Re: VB.NET HELP[REP+] - dh240473 - 30.06.2016

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



Re: VB.NET HELP[REP+] - iKarim - 30.06.2016

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.


Re: VB.NET HELP[REP+] - dh240473 - 30.06.2016

Thx!!! It Work Properly ! REP+ ALL