Android Question What is the equivalent of these curl command in b4a's jokhttputils2?

Hanz

Active Member
Hi, anyone knows the equivalent the ff code in jokhttputils2?

B4X:
DATA="INFO FOR DB;"
curl --request POST \
    --header "Content-Type: application/json" \
    --header "NS: test" \
    --header "DB: test" \
    --user "root:root" \
    --data "${DATA}" \
    http://localhost:8000/sql

I'm doing the codes below and it seems not working.

B4X:
Dim j As HttpJob
    j.Initialize("j", Me)
    
    j.Username = "root"
    j.Password = "root"
    
    j.PostString("http://localhost:8000/sql", "info for db")
    
    j.GetRequest.SetContentType("application/json")
    j.GetRequest.SetHeader("NS","test")
    j.GetRequest.SetHeader("DB","test")
    
    Wait For (j) jobdone (j As HttpJob)
    If j.Success Then
        Log(j.GetString)
    Else
        Log(j.ErrorMessage)
    End If
[/code
 
Top