Put a web page in a string

If your server is Win32, you could use the following function to put a page in a string. It’s based upon a service of the MSXML library, which installation is an easy task (and maybe it’s a service already running)

Function GetPage( url As String ) As String
     Dim objHttp As Variant
     Set objHttp = CreateObject( "Msxml2.ServerXMLHTTP" )
     Call objHttp.Open( "GET", url, False )
     Call objHttp.Send()
     If objHttp.status <> 200 Then
          GetPage = "FAILED (status: " & objHttp.status & ")"
     Else
          Dim contentType As String
          contentType = objHttp.getResponseHeader( "Content-Type" )
          If contentType = "text/html" Then
               GetPage = objHttp.responseText
          Else
               GetPage = "Not HTML (type: " & contentType & ")"
          End If
     End If
     Set objHttp = Nothing
End Function

(revised text from my own comment 12271511 at Experts-Exchange)

2 Replies to “Put a web page in a string”

  1. I finally have given up and decided to post a comment on this post because I couldn’t figure out where to leave comments or questions on your page.

    But anyways, I had a question about Domino 6.5. Do you know if it possible to create an RSS or XML feed using a Domino database or by accessing Domino databases from outside using a language like PHP??

    I have been having a hell of a time trying to figure out what article topics I need to be looking for on this subject.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.