1

I have a vb.net application where I am sending error string to a php page to process it.

Look at this: How to send and recieve data from Visual Basic to PHP?

But now, I want to send and receive array data from Visual Basic to PHP.

Well, if the errorString is like this array:

Dim errorString As String = new String(2) {}
errorString(0) = "Hello"
errorString(1) = "World!" ,

how can I send this errorString?

Anyone help me!

pah
  • 4,700
  • 6
  • 28
  • 37
hitman.star
  • 73
  • 10

1 Answers1

0

Assuming you're folllowing the example in the link you gave above, this should work:

Dim errorString = "errorString[0]=Hello&errorString[1]=World"

...

Dim byteArray As Byte() = Encoding.UTF8.GetBytes(errorString)

Obviously if you want to do this programatically, where you don't know the contents of the array in advance, then you might have to do a loop through the array to build up the string one field at a time.

On the PHP side, you should then be able to do (for example):

foreach ($_POST['errorString'] as $key => $value) {
echo $value . "<br />";
}

This will allow you to access all the fields in the errorString array.

ADyson
  • 57,178
  • 14
  • 51
  • 63