shahin
Active Member
Writing a macro in post request when i run it, it brings unexpected response which i don't want. Perhaps, it is unable to fetch response from the targeted page. Can't identify the mistake I'm doing? The original url I'm pasting under my code.
Box to be checked before performing search:
Industry Role = Professional Services Providers
Other Criterion = APEX
Original url = "https://www.infocomm.org/cps/rde/xchg/infocomm/hs.xsl/memberdirectory.htm"
How I Searched is shown in the picture:
Box to be checked before performing search:
Industry Role = Professional Services Providers
Other Criterion = APEX
Code:
Sub Xmlpost()
Dim http As New MSXML2.XMLHTTP60
Dim html As New HTMLDocument
Dim postdata As String
postdata = "DoMemberSearch=1&mas_last=&mas_comp=&mas_city=&mas_stat=&mas_cntr=&mas_type=Professional+Services+Providers&OtherCriteria=1"
With http
.Open "POST", "https://www.infocomm.org/cps/rde/xchg/infocomm/hs.xsl/memberdirectory.htm", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
.send postdata
html.body.innerHTML = .responseText
End With
MsgBox http.responseText
End Sub
Original url = "https://www.infocomm.org/cps/rde/xchg/infocomm/hs.xsl/memberdirectory.htm"
How I Searched is shown in the picture: