Android Question "curl" equivalent in B4A

kepler

Active Member
Licensed User
Longtime User
Hi,

I want to use in B4A the equivalente expression in Php:

curl -F "targets=@<filename>" "http://mydomain.com/script.php?<args>"

I provide a filename with text data (<filename>) and the arguments (<args>).

So it's a Post and Get request at the same time...

Any ideas?

Kind regards,

Kepler
 

DonManfred

Expert
Licensed User
Longtime User
HTTPUTILS2 (okHTTP Version as this is rewdy for Android 6)

Especially you should look at this example.
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
B4X:
curl -X POST --include 'https://neutrinoapi-phone-validate.p.mashape.com/phone-validate' \
  -H 'X-Mashape-Key: Fe5pwHzYKdmshHMC2Kq7NUIN0X3Ap1J54uxxxx62nFgdNmBJX9' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Accept: application/json' \
  -d 'number=+447522123456'

B4X:
....
    job1.Initialize("MyJob", Me)
    job1.PostString("https://neutrinoapi-phone-validate.p.mashape.com/phone-validate","number="&numberphone)
    job1.GetRequest.SetHeader("X-Mashape-Key",  yourkey)
    job1.GetRequest.SetHeader("Content-Type", "application/json")
    job1.GetRequest.SetContentEncoding("text/plain")
....
 
Upvote 0
Top