Results 1 to 3 of 3

Thread: Including data from another server?

  1. #1

    Thread Starter
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237

    Question Including data from another server?

    I have an ASP page running on server A
    I want to embed outout from an asp file on server B

    I don't mind if it is importing the rendered output or calling a function within the remote file.


    Is this possible?
    Does the thread even make sense?

    Don't even think about suggesting an inline frame as the script on server A will not actually be displaying a webpage to the browser...
    Another light-hearted post from Guru

  2. #2

    Thread Starter
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237

    Re: Including data from another server?

    OK. I've discovered I can include and Internet Transfer Control within the asp.

    Not the fastest solution but it works.

    Any more ideas?
    Another light-hearted post from Guru

  3. #3
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Including data from another server?

    Sure, MSXML ..

    Code:
    '// example usage
    Dim sText
    sText = GetHttp("http://www.mywebsiteurl.com/default.asp?this=that")
    If Len(sText) Then
        Response.Write GetText(sText, "mystarttag", "myendtag")
    End If
    
    '// get data from website
    Function GetHttp(ByVal pURL)
        Dim objHttp
        On Error Resume Next
        Set objHttp = CreateObject("Microsoft.XMLHTTP")
        objHttp.Open "GET", pURL, False
        objHttp.Send ""  
        GetHttp = objHttp.ResponseText
        Set objHttp = Nothing
    End Function
    
    '// get specific text from data
    Function GetText(ByVal pText, ByVal pStart, ByVal pEnd)
        Dim iStart, iEnd, sTemp
        On Error Resume Next
        iStart = InStr(1, pText, pStart, vbTextCompare)
        If iStart > 0 Then
            iEnd = InStr(iStart, pText, pEnd, vbTextCompare)
            If iEnd > 0 Then
                sTemp = Mid(pText, iStart, iEnd-iStart) 
                GetText = Trim(sTemp)
            End If
        End If
    End Function
    Last edited by rory; Mar 9th, 2007 at 01:57 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width