Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Farshad

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...