View Full Version : XML shoutcast statistics using Visual Basic code only
Gourou
2nd May 2002, 23:38
this isnt a question, but being a developer, I've run this a lot... as far as I can tell, the OCX that ships with VB for getting web pages will NOT get the XML from a shoutcast server, no matter how hard you try, so I found a solution, it's fairly elegant, if fairly large, and it's pure code, no controls, no PHP or Perl or other XML involved, just VB code, I'll post it up here just as soon as I put in some more error checks, I just thought it too exciting to wait :)
Please note, this code requires winsock2, which comes with win98 and on up, or win95 with an update, I dun think anyone else that uses VB uses anything else, so that's not much of a prob :)
Also, the original of this code isnt mine, but I have modified it to hell and back, so I'm going to post it, but disclaim credit for making it, all I've done is make it get the XML.
Gourou
3rd May 2002, 03:10
I hope somebody out there appreciates this... I put a readme with the files, but I'll say it here also, just add all 4 files to your project, there are 2 modules, and 2 class files, you dont need to change anything to use them, just add them, getting the XML is super easy, here's how it goes..
lets say you have a textbox you want to show the XML you get back in, so Text1 = GetXML("server", port, "password"), lets say you wanted to call up my server (as if it's ever up), you would use,
Text1 = GetXML("68.53.201.86", 8010, "hijack")
that will return the XML, unparsed, it just returns the page, but it's more than I could EVER do before with just VB, I had to use a PHP script which was too slow for my tastes, so there you have it folks :)
Gourou
28th May 2002, 21:43
oops, I boo-booed, I'll post the fix and a new file up here in a bit
Gourou
28th May 2002, 21:50
at the top of the Function GetXML, add this....
'
Dim lngRetValue As Long
'
lngRetValue = modWinsockAPI.InitializeWinsock(SOCKET_VERSION_22)
'
If lngRetValue <> 0 Then GetXML = "Err - Couldnt Init Winsock": Exit Function
'
Also need to add WSACleanup after every switchback in the IF statement, you can not do it, but it's not a full cleanup then and it forces winsock to do it, which isnt a good way to code, I'll post that code up here as the full files, you can look at what I mean if you dont understand
I forgot this cuz it was in my Form_Load
Gourou
28th May 2002, 23:00
the updated file
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.