NTVMSNBC Haberleri (tr)
Dec 27,2008 00:00 by RubeNiS
XMLHTTP bileşeni ile Ntvmsnbc.com adresinden güncel haberler listelenmekte.
Kodu .asp sayfası olarak kayıt ettikten sonra çalıştırmanız yeterli.

********************************************************

<%
    Public  Function VeriAl(strGelen)
        SET  objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") 
        With  objXMLHTTP
            .Open "GET", strGelen,  False
            .Send
            VeriAl = .ResponseBody
        End  With
        VeriAl = BinaryToString(LEft(VeriAl, 1000))
        SET  objXMLHTTP =  Nothing 
    End  Function

    Private  Function BinaryToString(Binary)
        Dim  cl1, cl2, cl3, pl1, pl2, pl3
        Dim  L
        cl1 = 1
        cl2 = 1
        cl3 = 1
        L = LenB(Binary)

        Do  While cl1<=L
            pl3 = pl3 &  Chr(AscB(MidB(Binary,cl1,1)))
            cl1 = cl1 + 1
            cl3 = cl3 + 1
            If  cl3>300  Then
                pl2 = pl2 & pl3
                pl3 = ""
                cl3 = 1
                cl2 = cl2 + 1
                If  cl2>200  Then
                    pl1 = pl1 & pl2
                    pl2 = ""
                    cl2 = 1
                End  If
            End  If
        Loop
        BinaryToString = pl1 & pl2 & pl3
    End  Function


Function  TRTemizle(strGelen)   
    strGelen =  Replace(strGelen, "İ", "?")
    strGelen =  Replace(strGelen, "ş", "?")
    strGelen =  Replace(strGelen, "ğ", "?")
    strGelen =  Replace(strGelen, "ö", "?")
    strGelen =  Replace(strGelen, "ı", "?")
    strGelen =  Replace(strGelen, "ü", "?")
    strGelen =  Replace(strGelen, "ç", "?")
    strGelen =  Replace(strGelen, "Ş", "?")
    strGelen =  Replace(strGelen, "Ğ", "?")
    strGelen =  Replace(strGelen, "Ö", "?")
    strGelen =  Replace(strGelen, "Ü", "?")
    strGelen =  Replace(strGelen, "Ç", "?")
    TRTemizle = strGelen
End  Function

SET  RF = Request.Form

strIcerik = (VeriAl("http://www.ntvmsnbc.com/news/BCList2.txt"))
strKategori =  TRIM(RF("Kategori"))
IF  strKategori = ""  THEN  strKategori = "G"
iBasla =  Instr(strIcerik, "+" & strKategori)+Len(strKategori)+1
iBitis =  Instr(iBasla, strIcerik, "+")-1
strIcerik =  Mid(strIcerik, iBasla, iBitis-iBasla)

FOR  EACH strSatir IN  Split(strIcerik,  CHR(13))
    IF  Instr(strSatir, "|") > 0  THEN
        strLink = "http://www.ntvmsnbc.com" &  TRIM(Replace(Left(strSatir,  Instr(strSatir, "|")-1),  CHR(13), " "))
        strBaslik =  TRIM(Right(strSatir,  Len(strSatir)-Instr(strSatir, "|")))

%>

<a href="<%=strLink%>" target="_blank"><%=strBaslik%></a><br>
<%
    END  IF
NEXT
strIcerik = ""
%>