ChainsawJoe
Programmer
I'm really getting into ServerXMLHTTP and XMLHTTP recently, incorporating its functionality into so many new projects within the past month that its just a matter of time before I've a) exhausted all possible uses for it or b) recreated everything google have done recently.
Hmm.. neither likely. how about c) get told off for wasting time at work and told to actually get on with my job?
Anyway. One more use here: since I recently used it to process a succession of xml feeds and download all images mentioned within the feed onto a local server in order to duplicate the content of a site without sucking bandwidth, I wondered what else it can access.
I'm currently trying to display the currently playing tune from a shoutcast radio station via the stream address used in winamp, spoofed the user-agent of the asp page to be winamp (cos otherwise you just get the contents of the stream's shoutcast html homepage) and used a selection of versions of xmlhttp and serverxmlhttp, each with different results, each failing.
The best I could get was when using MSXML2.XMLHTTP.4.0 - then it hangs. Doesn't get past the Send() call. Dooesn't erro, just doesn't do anything else..
Here's what I've got for this lil scripty - any tips, pointers, downright flaming are welcome
By the way - that code sometimes seems to not close any connections, so you might need to do an iireset every so often if you run it enough.. else you get a "HTTP 403.9 - Access Forbidden: Too many users are connected" error
If I use msxml2.xmlhttp.4.0, it hangs.
If I use msxml2.xmlhttp.5.0, it fails with this message "The connection with the server was terminated abnormally" at the waitforresponse line.
Same if I use msxml.serverxmlhttp.
ServerMSXMLHTTP.4.0 = "Access is denied" at .Send()
ServerMSXMLHTTP.3.0 = Timeout
I assume that it might be something to do with the fact that it's streaming media and as such can never have an entire "file" to be downloaded, hence the code just hangs.
I'm guessing that what i'm trying to do here isn't actually possible, but just in case...
Appreciate any input!
Again - there's no real point to this and I'm sure I could achieve it by some other method, but was just.. y'know.. wonderin..
--------------------------------------------------
- better than toast.
Penguins - better than --------------------------------------------------
Hmm.. neither likely. how about c) get told off for wasting time at work and told to actually get on with my job?
Anyway. One more use here: since I recently used it to process a succession of xml feeds and download all images mentioned within the feed onto a local server in order to duplicate the content of a site without sucking bandwidth, I wondered what else it can access.
I'm currently trying to display the currently playing tune from a shoutcast radio station via the stream address used in winamp, spoofed the user-agent of the asp page to be winamp (cos otherwise you just get the contents of the stream's shoutcast html homepage) and used a selection of versions of xmlhttp and serverxmlhttp, each with different results, each failing.
The best I could get was when using MSXML2.XMLHTTP.4.0 - then it hangs. Doesn't get past the Send() call. Dooesn't erro, just doesn't do anything else..
Here's what I've got for this lil scripty - any tips, pointers, downright flaming are welcome
Code:
on error resume next
dim i : i=0
dim oXMLHTTP : set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.4.0")
dim oStream : set oStream = createobject("ADODB.Stream")
oXMLHTTP.Open "POST", "[URL unfurl="true"]http://64.62.252.134:6670",[/URL] true
oXMLHTTP.setRequestHeader "User-Agent","WinampMPEG/5.1"
oXMLHTTP.Send
'-- only some (server)xmlhttps support waitforresponse
while i<1000 and oXMLHTTP.readyState<>4
oXMLHTTP.waitForResponse 3
i=1+1
response.Write ". "
response.Flush
wend
response.write oXMLHTTP.getAllResponseHeaders
response.flush
if err.number<>0 then
response.Write err.number & "<br /> " & err.Description & "<br />" & err.Source & "<hr />" & vbcrlf
response.Write oXMLHTTP.parseError.Reason
end if
set oStream = nothing
set oXMLHTTP = nothing
on error goto 0
By the way - that code sometimes seems to not close any connections, so you might need to do an iireset every so often if you run it enough.. else you get a "HTTP 403.9 - Access Forbidden: Too many users are connected" error
If I use msxml2.xmlhttp.4.0, it hangs.
If I use msxml2.xmlhttp.5.0, it fails with this message "The connection with the server was terminated abnormally" at the waitforresponse line.
Same if I use msxml.serverxmlhttp.
ServerMSXMLHTTP.4.0 = "Access is denied" at .Send()
ServerMSXMLHTTP.3.0 = Timeout
I assume that it might be something to do with the fact that it's streaming media and as such can never have an entire "file" to be downloaded, hence the code just hangs.
I'm guessing that what i'm trying to do here isn't actually possible, but just in case...
Appreciate any input!
Again - there's no real point to this and I'm sure I could achieve it by some other method, but was just.. y'know.. wonderin..
--------------------------------------------------
- better than toast.
Penguins - better than --------------------------------------------------