views:

101

answers:

1

Hi

I need to pass encoded string to php page.

To convert string to iso:

Dim result As Byte() = Encoding.Convert(Encoding.UTF8, Encoding.GetEncoding("iso-8859-1"), input)

I have this code to pass string, but how I must do it to pass Byte (variable result) instead of the string (variable MyVarString)?

Dim client As WebClient
Dim data As Stream
Dim reader As StreamReader
Dim baseurl As String
baseurl = "http://example.com/api/mypage2.php"
client = New WebClient
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
client.QueryString.Add("mensaje", MyVarString)
data = client.OpenRead(baseurl)
reader = New StreamReader(data)
s = reader.ReadToEnd()
data.Close()
reader.Close()
Etc.
A: 

If your question is how to pass a byte array then just Base64 encode it:

Dim encResult = Convert.ToBase64String(result)

Then in PHP use the built-in decoder base64_decode(string)

Chris Haas