Hi guys, hope someone can help me, trying for 2 days now and read through all the questions regarding HTTPSocket here in the forum.
I’ve written a small app which should POST two values to a local HTTP server. If I use my own browser it works perfectly and the HTTP server can read both value (id and option). Here’s the URL:
If I use the chrome extension RestClient the same success, the Http server can read both value.
If I now try the same with my program, both values are undefined (on the server side). My code is as follows:
[code] Dim form As New Dictionary
Dim HTTPSocket1 As New HTTPSocket
Dim statuscode As Int16
sLine = “http://127.0.0.1:3000?id=123456&option=789”
form.Value(“Line”) = sLine
Dim result As String
Dim InternetHeadersValue As InternetHeaders
InternetHeadersValue = HTTPSocket1.RequestHeaders
InternetHeadersValue.AppendHeader (“Content-Type”, “application/x-www-form-urlencoded”)
InternetHeadersValue.AppendHeader (“DNT”, “1”)
InternetHeadersValue.AppendHeader (“Accept-Encoding”, “gzip,deflate,sdch”)
InternetHeadersValue.AppendHeader (“Origin”, “chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo”)
InternetHeadersValue.AppendHeader (“User-Agent”, “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36”)
InternetHeadersValue.AppendHeader (“Accept-Charset”, “UTF-8”)
HTTPSocket1.SetFormData(form)
result = HTTPSocket1.Post(sLine,0)
statuscode = HTTPSocket1.HTTPStatusCode
If statuscode <> 200 Then
MsgBox ("Error: " + Str(statuscode))
End
Return TRUE[/code]
Please note that I tried already to set the InternetHeader exactly as to what the chrome extension is doing as well. Only “Accept-Charset” was added as the last try but also that didn’t do any change to the code not doing what it should do.
What am I doing wrong?
Thanks in advance,
Andreas