how to grab content from another site

Discussion in 'ASP General' started by Christopher Brandsdal, Jul 12, 2004.

  1. Hi!

    I'm stuck on a little problem...

    I want to get te article heading-text and teaser from
    http://www.avisa-valdres.no and display it on another page using asp code...

    An example on this: www.valdres.no is picking news from www.avisa-valdres.no
    and displaying it on valdres.no...

    How can I do this with ASP/VBScript code??
    Any idea?

    The code on valdres.no wich pics the content is made in iHTML, so that does
    not help me much ;)

    regards
    Christopher Brandsdal
    Norway
     
    Christopher Brandsdal, Jul 12, 2004
    #1
    1. Advertising

  2. Christopher Brandsdal

    Steven Burn Guest

    http://aspfaq.com/show.asp?id=2173

    --

    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!


    "Christopher Brandsdal" <> wrote in message
    news:u2Bs#...
    > Hi!
    >
    > I'm stuck on a little problem...
    >
    > I want to get te article heading-text and teaser from
    > http://www.avisa-valdres.no and display it on another page using asp

    code...
    >
    > An example on this: www.valdres.no is picking news from

    www.avisa-valdres.no
    > and displaying it on valdres.no...
    >
    > How can I do this with ASP/VBScript code??
    > Any idea?
    >
    > The code on valdres.no wich pics the content is made in iHTML, so that

    does
    > not help me much ;)
    >
    > regards
    > Christopher Brandsdal
    > Norway
    >
    >
     
    Steven Burn, Jul 12, 2004
    #2
    1. Advertising

  3. Thanks!

    But there is only one more problem...
    When I grab a site containing the norwegian characters æøå, it does not
    understand the characters. Is there any way I can get it to understand æøå?


    "Steven Burn" <> wrote in message
    news:...
    > http://aspfaq.com/show.asp?id=2173
    >
    > --
    >
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    >
    > "Christopher Brandsdal" <> wrote in message
    > news:u2Bs#...
    > > Hi!
    > >
    > > I'm stuck on a little problem...
    > >
    > > I want to get te article heading-text and teaser from
    > > http://www.avisa-valdres.no and display it on another page using asp

    > code...
    > >
    > > An example on this: www.valdres.no is picking news from

    > www.avisa-valdres.no
    > > and displaying it on valdres.no...
    > >
    > > How can I do this with ASP/VBScript code??
    > > Any idea?
    > >
    > > The code on valdres.no wich pics the content is made in iHTML, so that

    > does
    > > not help me much ;)
    > >
    > > regards
    > > Christopher Brandsdal
    > > Norway
    > >
    > >

    >
    >
     
    Christopher Brandsdal, Jul 13, 2004
    #3
  4. Christopher Brandsdal

    Evertjan. Guest

    Christopher Brandsdal wrote on 13 jul 2004 in
    microsoft.public.inetserver.asp.general:

    > When I grab a site containing the norwegian characters æøå, it does
    > not understand the characters. Is there any way I can get it to
    > understand æøå?


    I do not understand "understand", since a programme is not understanding
    anything.

    Perhaps:

    s = "æø"

    s = replace(s,"æ","ae")
    s = replace(s,"ø","[slashed o]") ' or whatever

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jul 13, 2004
    #4
  5. http://forums.devarticles.com/archive/t-3992

    see this link to understand what I mean....

    "Evertjan." <> wrote in message
    news:Xns952570801E41Ceejj99@194.109.133.29...
    > Christopher Brandsdal wrote on 13 jul 2004 in
    > microsoft.public.inetserver.asp.general:
    >
    > > When I grab a site containing the norwegian characters æøå, it does
    > > not understand the characters. Is there any way I can get it to
    > > understand æøå?

    >
    > I do not understand "understand", since a programme is not understanding
    > anything.
    >
    > Perhaps:
    >
    > s = "æø"
    >
    > s = replace(s,"æ","ae")
    > s = replace(s,"ø","[slashed o]") ' or whatever
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    Christopher Brandsdal, Jul 13, 2004
    #5
  6. found the solution myself :)

    <%
    'function for reading "non-english" charachters
    Function BinToText(varBinData, intDataSizeInBytes)
    Dim objRS
    Const adFldLong = &H00000080
    Const adVarChar = 200
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Fields.Append "txt", adVarChar, intDataSizeInBytes, adFldLong
    objRS.Open
    objRS.AddNew
    objRS.Fields("txt").AppendChunk varBinData
    BinToText = objRS("txt").Value
    objRS.Close
    Set objRS = Nothing
    End Function

    Function GetHTML(strURL,strStart,strEnd)
    Dim objXMLHTTP, strReturn, strHTML
    Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
    objXMLHTTP.Open "GET", strURL, False
    objXMLHTTP.SetRequestHeader "content-type","text/html;charset=ISO-8859-1"
    objXMLHTTP.Send
    strHTML = BinToText(objXMLHTTP.responseBody, 4800)
    Set objXMLHTTP = Nothing

    Dim st,en
    st=Instr(strHTML,strStart)
    If st<>0 Then
    st=st+Len(strStart)
    en=Instr(st,strHTML,strEnd)
    strReturn=Mid(strHTML, st, en-st)
    Else
    strReturn="Ingen driftsmeldinger tilgjengelig."
    End If
    GetHTML = strReturn
    End Function

    '*****************----- MY CONFIG SECTION START -----*****************
    dim URLsnatch, HTMLsBlock, HTMLeBlock
    'Webpage to scrape
    URLsnatch = "http://www.avisa-valdres.no/default.asp"
    'Where to start scraping the webpage
    HTMLsBlock = "<! Hovedkolonne ->"
    'Where to end scraping the webpage
    HTMLeBlock = "<! Vertikal skille 2 ->"
    '******************----- MY CONFIG SECTION END -----******************
    'Write it:
    Dim grabbedText
    grabbedText = GetHTML(URLsnatch,HTMLsBlock,HTMLeBlock)
    %>

    <%=grabbedtext%>


    "Christopher Brandsdal" <> wrote in message
    news:#...
    > http://forums.devarticles.com/archive/t-3992
    >
    > see this link to understand what I mean....
    >
    > "Evertjan." <> wrote in message
    > news:Xns952570801E41Ceejj99@194.109.133.29...
    > > Christopher Brandsdal wrote on 13 jul 2004 in
    > > microsoft.public.inetserver.asp.general:
    > >
    > > > When I grab a site containing the norwegian characters æøå, it does
    > > > not understand the characters. Is there any way I can get it to
    > > > understand æøå?

    > >
    > > I do not understand "understand", since a programme is not understanding
    > > anything.
    > >
    > > Perhaps:
    > >
    > > s = "æø"
    > >
    > > s = replace(s,"æ","ae")
    > > s = replace(s,"ø","[slashed o]") ' or whatever
    > >
    > > --
    > > Evertjan.
    > > The Netherlands.
    > > (Please change the x'es to dots in my emailaddress)

    >
    >
     
    Christopher Brandsdal, Jul 13, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hazz
    Replies:
    6
    Views:
    50,040
    SkyUCHC
    Jun 9, 2010
  2. patrick boulay
    Replies:
    2
    Views:
    501
    Vitaly
    Aug 9, 2006
  3. Hoa
    Replies:
    5
    Views:
    149
  4. Jeff
    Replies:
    10
    Views:
    166
    Matt Garrish
    Dec 19, 2003
  5. Robert T.

    Can't grab remote content

    Robert T., Sep 20, 2006, in forum: Javascript
    Replies:
    1
    Views:
    95
    Robert T.
    Sep 20, 2006
Loading...

Share This Page