farshad Posted November 10, 2003 Posted November 10, 2003 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 Quote Farshad
Administrators PlausiblyDamp Posted November 10, 2003 Administrators Posted November 10, 2003 Could you not use the WebClient class and an XMLDocument instead of going through COM interop? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.