.net

farshad

Well-known member
Joined
May 1, 2003
Messages
109
Location
London
Hello,
When I run a simple VBA code to retrieve data from a site, it works fine and data is returned. But when I do the same in vb.net, no data is returned.
Do you see why?
Thanks

-------------VBA code--------------

Private Sub CommandButton1_Click()
Dim s As String
Dim myDataObject As New DataObject
Dim doc As Object

Set doc = CreateObject("msxml2.ServerXMLHTTP")
doc.Open "POST", "https://www.mark-it.com/export.php", False
doc.setrequestheader "Content-Type", "application/x-www-form-urlencoded"
doc.setrequestheader "User-Agent", "curl"

s = "user=hello"
s = s & "&password=pass"
s = s & "&version=" & "2"
s = s & "&format=" & "xml"
s = s & "&report=RedEntity"

doc.send (s)

Dim x As String
x = doc.responsetext responsetext returns the xml data...

End Sub


----------.Net code----------------

Private Sub GetData()
Dim s As String
Dim myDataObject As New DataObject
Dim doc As Object

doc = CreateObject("msxml2.ServerXMLHTTP")
doc.open("POST", "https://www.mark-it.com/export.php", False)
doc.setrequestheader("Content-Type", "application/x-www-form-urlencoded")
doc.setrequestheader("User-Agent", "curl")

s = "user=hellp"
s += "&password=pass"
s += "&version=" & "2"
s += "&format=" & "xml"
s += "&report=RedEntity"

doc.send(s)

Dim x As String
x = doc.responsetext responsetext DOES NOT return the xml data...??????????????????

End Sub
 
Back
Top