Jump to content
Sign in to follow this  
robertcollier4

Why _INetGetSource not working for this website?

Recommended Posts

robertcollier4

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)

Share this post


Link to post
Share on other sites
FireFox

Hi,

From :

#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 by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
robertcollier4

Works beautifully, thanks.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×