Hi
I want to read a source code of a web page & then write it into a text file using vbscript. I have used this code but not working properly.
Error : ActiveX component can't create the object

Option Explicit

Dim objHttp
Dim strUrl
Dim strData

' Create a HTTP instance
Set objHttp = CreateObject("ActiveXperts.Http")

' Write some information to console
WScript.Echo "ActiveSocket " & objHttp.Version & " demo."
WScript.Echo "Expiration date: " & objHttp.ExpirationDate & vbCrLf

Do
   strUrl = inputbox( "Enter a URL", "Input", "www.activexperts.com/products" )
Loop until strUrl <> ""

objHttp.LogFile = "C:\HttpLog.txt"

objHttp.Connect( strUrl )
If( objHttp.LastError <> 0 ) Then
   WScript.Echo "Error " & objHttp.LastError & ": " & objHttp.GetErrorDescription( objHttp.LastError )
Else
   strData = objHttp.ReadData
   If( objHttp.LastError <> 0 ) Then
     WScript.Echo "Error " & objHttp.LastError & ": " & objHttp.GetErrorDescription( objHttp.LastError )
   Else
     WScript.Echo strData
   End If
   objHttp.Disconnect
   WScript.Echo "Disconnect."
End If

WScript.Echo "Ready."

hi
u can try this
sSrcUrl = "http://www.google.com"

'sSrcUrl = "C:\Inetpub\wwwroot\mypage.html"

Set oHTTP = CreateObject("Microsoft.XMLHTTP")


bGetAsAsync = False

oHTTP.open "GET", sSrcUrl, bGetAsAsync
oHTTP.send

If oHTTP.status <> 200 Then
WScript.Echo "unexpected status = " & oHTTP.status & vbCrLf & oHTTP.statusText
WScript.Quit

End If


MsgBox oHTTP.responseText

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.