[VB6] Get Page Source Web Using MSXML2.ServerXMLHTTP


Deskripsi
      Get page source website using MSXML2.ServerXMLHTTP without proxy.

Howto
    Dim objHttp As Object, strText, strUrl As String
    strUrl = "http://www.target-web.com" 'url must complete
    Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")
    objHttp.Open "GET", "", False
    objHttp.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36"
    objHttp.Send ("")
    strText = objHttp.responseText
    Set objHttp = Nothing
    msgbox strText

*note : if you want to connect using proxy , you must execute command in Command Prompt :
           proxycfg -d 'if you want to direct connect access to the internet
           proxycfg -p 10.12.xx.xx:8080 "<local>" 'if you want connect using proxy.
                             -d as direct
                             -p as proxy
                             -10.12.xx.xx as proxy server
                             - <local> as local computer 
          
*tips : in VB you can create a file text , so you can can create batch file and then execute from vb.  
     

Post a Comment

Harap gunakan bahasa yang baik dan sopan, terima kasih