2011-11-28 6 views
0

IHTMLDocument 객체를 사용하여 웹 페이지를 구문 분석하는 Visual Basic 2010 Express 프로젝트가 있습니다..NET의 createDocumentFromUrl 호출에 사후 변수 포함

ihtml = GetHTML("www.blah.com?getvar1=x&getvar2=y") 
ihtml.getElementsByTagName("A") 
ihtml.getElementById("myel") 
etc, etc... 

내가 포함 할 수 방법을 알아 내려고 노력 해요 : 나는 기본적으로 기능과 같은 물건을하고 있어요

Private Function GetHTML(ByVal url As String) 
    Dim htmldoc As New HTMLDocument() 
    Dim ihtml2 As IHTMLDocument2 
    Dim ihtml3 As IHTMLDocument3 
    Dim iPersistStream As IPersistStreamInit 

    iPersistStream = DirectCast(htmldoc, IPersistStreamInit) 
    iPersistStream.InitNew() 

    ihtml2 = htmldoc.createDocumentFromUrl(url, vbNullString) 

    Do Until ihtml2.readyState = "complete" 
     'required for htmlresult.readyState to transition from "loading" to "complete" 
     System.Windows.Forms.Application.DoEvents() 
    Loop 
    ihtml3 = DirectCast(ihtml2, IHTMLDocument3) 

    Return ihtml3 
End Function 

: 여기 웹 페이지를 검색하기 위해 사용하고있는 기능입니다 HTML 문서를 검색 할 때 URL 문자열 외에 POST 변수. 하는 나는 이런 식으로 뭔가를 할 수 있도록하고 싶습니다 의미 :

ihtml = GetHTML("www.blah.com?getvar1=x&getvar2=y",["postvar1=a","postvar2=b"]) 

그래서 나는이 가능하며 그렇지 않은 경우 나 포스트 변수를 포함 할 수 있도록하기 위해 기존 GetHTML 기능을 수정하고 싶습니다 아마이 일을하는 또 다른 방법이 있는지 알고 싶습니다. 도움을 줄 수있는 사람에게 감사드립니다.

당신은 각 입력 필드를 페이지로 이동 찾을 수있다 값이 다음에 InvokeMember에 전화를 설정 :이 디자인에 최선을 다하고 경우

답변