How can i set the right encoding into my post request function?
I tried : .setRequestHeader'encoding','ISO-8859-1'
But dont work
obs: the response xml have this header:
The function
Call
Thanks all
I tried : .setRequestHeader'encoding','ISO-8859-1'
But dont work
obs: the response xml have this header:
Code:
<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>
The function
Code:
Function HTTPSessionRequest(method, url, data)
Dim poStvars
Dim Xmlhttp
Dim Strheaders
Dim Sreturn
Dim Nlenhead
Dim Istart
Dim i, J
Dim Nfoundat
Dim Sref
'init
'Set Xmlhttp = CreateObject("MICROSOFT.XMLHTTP")
Set Xmlhttp = CreateObject("Msxml2.ServerXMLHTTP")
poStvars = Trim(data)
'connect
Xmlhttp.SetOption 2, 13056
Xmlhttp.Open method, Trim(url), False
With Xmlhttp
'set hdrs
If UCase(method) = "POST" Then
.setRequestHeader "Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded"[/URL]
End If
.setRequestHeader "User-Agent", _
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
'add the old referrer
.setRequestHeader "ACCEPT-LANGUAGE", "en-us"
.setRequestHeader "Accept", _
"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, " & _
"application/vnd.ms-excel, application/msword, */*"
'add a dummy cookie
.setRequestHeader "cookie", "dummy=dummy"
'send data
.Send poStvars
Strheaders = .getAllResponseHeaders()
Sreturn = .responseText
End With
'done with http
Set Xmlhttp = Nothing
HTTPSessionRequest = Sreturn
End Function
Call
Code:
s = HTTPSessionRequest("POST", PaginaDeConsulta, data1)
Thanks all