robertcollier4 Posted May 7, 2013 Share Posted May 7, 2013 Can anyone help me with why the following does not work? It works for other websites - but trying to get the HTML Source of the below Shoutcast stream listing website does not work. The below code gives me a blank MsgBox. Is there something special or some other function I need to use for this particular website? #include <INet.au3> #include <Array.au3> $HTMLSourceShoutcast = _INetGetSource("http://205.188.215.229:8024/played.html") MsgBox(0,0,$HTMLSourceShoutcast) Link to comment Share on other sites More sharing options...
FireFox Posted May 7, 2013 Share Posted May 7, 2013 (edited) Hi,From :expandcollapse popup#include <Inet.au3> #include <FileConstants.au3> TCPStartup() Local $sGet = "", $sHost = "", $iPort = 0, $iSocket = 0, $sReferer = "", $bRecvtmp = Binary(""), $bRecv = $bRecvtmp, $sRecv = "", _ $blHeaderStripped = False, $iEOH = 0, $hFile = 0 $sGet = "/played.html" $sHost = "205.188.215.229" $iPort = 8024 $iSocket = TCPConnect($sHost, $iPort) $sReferer = "http://" & $sHost & ":" & $iPort & "/" TCPSend($iSocket, _ "GET " & $sGet & " HTTP/1.1" & @CRLF & _ "User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)" & @CRLF & _ "Host: " & $sHost & @CRLF & _ "Accept: */*" & @CRLF & _ "Referer: " & $sReferer & @CRLF & _ "Connection: close" & @CRLF & _ @CRLF) While 1 $bRecvtmp = TCPRecv($iSocket, 2048, 1) If @error Then ExitLoop If BinaryLen($bRecvtmp) = 0 Then ContinueLoop If $blHeaderStripped Then $bRecv &= $bRecvtmp Else $sRecv = BinaryToString($bRecvtmp) $iEOH = StringInStr($sRecv, @CRLF & @CRLF, 2) If $iEOH > 0 Then $bRecv = BinaryMid($bRecvtmp, $iEOH + 4) $blHeaderStripped = True EndIf EndIf WEnd TCPCloseSocket($iSocket) TCPShutdown() $hFile = FileOpen("test.html", BitOR($FO_BINARY, $FO_OVERWRITE)) FileWrite($hFile, $bRecv) FileClose($hFile)Br, FireFox. Edited May 7, 2013 by FireFox Link to comment Share on other sites More sharing options...
robertcollier4 Posted May 7, 2013 Author Share Posted May 7, 2013 Works beautifully, thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now