[Gambas-user] HttpClient class - post method Q&A
Matteo Pasotti
matteo.pasotti at ...626...
Fri Sep 11 20:46:39 CEST 2009
Hi,
I'm developing a little application that uses the httpclient class from
gb.net.curl component.
In this case I used the Post method but I'm not been able to find
documentation about it on gambasdoc.org. So, considering that I solved
my problem, I would share my little portion of code hoping that it will
be useful for someone else.
DIM str AS String
DIM t AS HttpClient
t.Async = FALSE
t.URL = "http://www.example.dot/something.php"
t.Timeout = 60
str = "Hello"
t.Post("application/x-www-form-urlencoded", "s=" & str)
IF t.Status < 0 THEN
Message("error")
ELSE
IF Lof(t) THEN READ #t, buffer, Lof(t)
Message(buffer)
ENDIF
The only problem I faced is about str encoding. I solved this problem
using Replace function (with a String array manually populated) but I
don't know if there's a better way. Any tips?
Regards,
Matteo
More information about the User
mailing list