iOS Question Posting Parameters to download2 in b4i

gmoriwaki

Member
Licensed User
I am calling an api with the following syntax: testapi.php?fname=guy

How do I call it from download2? I see examples that use the following format: j.download2("http://www.test.com/testapi.php", some array....)

I tried the following:

j.download2("http://www.test.com/testapi.php", array as string("fname","guy"))

When I try to run the application, I get an range or index out of bounds.

Am I passing the parameters correctly?

Thanks - Guy
 
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
When I copy the following url to the browser: http://testapi.php?fname=guy

It returns json data with guy selected.

I am trying to do it in b4i using the following:

dim j as httpjob
j.initialize("",me)

j.download2("http://www.test.com/testapi.php", array as string("fname","guy"))

...

Here is the error I get when I run/compile:

error occured on line: 231(httpjob)
Range or index out of bounds
...
your code its right.
this example is working here.
B4X:
    Private job As HttpJob
    job.Initialize("",Me)
    job.Download2("http://www.example.com", Array As String("key1", "value1", "key2", "value2"))
what's after download2? post the entire request and response code if possible.
 
Upvote 0
Top