Android Question curl -X GET

namnach

Member
Licensed User
Longtime User
Hi

i need a help in curl
i test a curl command at pc konsole at first time like this

B4X:
curl -X GET http://localweb/pc1?command=time

response is ok: 03:34:20

how i send this with a button?

i try with HttpJob

B4X:
Process Globals..

DIM curl as HttpJob

Sub Button1_Click
Dim link as String
link="http://localweb/pc1?command=time"

' not sure - i try the secon parameter like this
curl.PostString(link,"")
curl.GetRequest.SetContentType("application/json")
end sub


Sub JobDone (Job as HttpJob)
if Job.Success then
 Log(Job.JobName & "ok" )
else
Log(Job.Error.Message)
end if
end Sub


Get "BadRequest"

Need a construction in this, please

thank you
Micha

EDIT:
Sorry can not delete posting..
Got it in other try with

B4X:
curl.Download2(link,Array of String(parameter))

txs
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
What is "localweb"? It seems that it is an webpage that is accessible on your pc with "localweb". Probably a webserver on your PC???
If yes then you need to use your PCs Internetip to connect to this host. Make sure the port 80 is forwarded to your PC in the routers configuration.
 
Upvote 0
Top