how to retrieve xml data from a remote server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iamjoe
    New Member
    • Sep 2008
    • 1

    how to retrieve xml data from a remote server

    I have a simple form that i need to post some data to...

    A customer will enter an upgrade id into a form on my server (SERVER-A) and I need to post that form to SERVER-B

    Here is my url that I need to hit
    https://SERVER-B.COM/webservice/upgrade/v1/registration.ph p?region=WSTSWP U8&upgid=F0A0B0 L250VT&upgpkgid =A2T0DGYTERD0&m ode=0

    If I load the SERVER-B url into a browser on it's own it will return this...

    <response>
    <code>609</code>
    </response>

    I need to grab/manipulate the <code> tag.

    I am savy with asp but have not used xml all that much. As I understand it now I cannot use xmlhttp request to get data from an outside server or a server other than my own.

    I'm stuck with something that must have been dealt to by someone smarter than I.
    Thanks
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    try this:
    Code:
    <%
    set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
    objHTTP.Open "GET", "http://www.mysite.com", false
    objHTTP.Send
    Response.Write objHTTP.ResponseText
    %>
    let me know if this helps.

    Jared

    Comment

    • KalleMOD
      New Member
      • Sep 2008
      • 7

      #3
      You can also use the WinHttpRequest object to retrieve the data from SERVER-B but then I guess you will be stuck with the same problem that I currently have (see http://bytes.com/forum/thread836732.ht ml).

      The WinHttpRequest object works a bit like the msxml2 object:

      Code:
      <%set objWinHttp = Server.createObject("WinHttp.WinHttpRequest.5.1")
      objWinHttp.open "POST", SERVER-B-URL
      content = FORM-DATA
      call objWinHttp.setRequestHeader("Content-type", "Content-type: application/x-www-form-urlencoded")
      call objWinHttp.setRequestHeader("Content-length", len(content))
      objWinHttp.send(content)
      %>
      Then you can get the response from the property objWinHttp.resp onseText

      From there on I'm stuck with the xml/html-DOM manipulation server-side, therefore I will keep an eye on this thread :)

      /KalleMOD

      Comment

      Working...