Please, help with Download2 sintax

Fossy

Member
Licensed User
Longtime User
Hello guys:

I search in forum for sintax of Downlod2, but I took hours and can't cleared...

I ONLY need ask to my CGI (made be me in FreePascal Linux)..., I need this:

http://www.domain.com/cgi-bin/nameofcgi?user=username&password=passwordname

And CGI respond with a string..., I need to get that string.

I have test with this:

Dim consulta As HttpJob
Dim resultado As String
...
...
consulta.Initialize("Consulta", Me)
resultado=consulta.Download2("http://www.xxxx.com/cgi-bin/movil?usuario=pepe&password=pepe",Array As String("Cadena",resultado))
Msgbox(resultado,"titulo")

And get nothing, and app crash with error.

Please, how I can get the string response from CGI?.

Thanks!!.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
And get nothing, and app crash with error.
You should check the logs and post the error message.

You have two options:
1. Build the complete URL and use HttpJob.Download.
2. Move all the parameters to the array and use HttpJob.Download2.

The result will only be available in the JobDone sub. See HttpUtils2 tutorial.
 
Upvote 0

Fossy

Member
Licensed User
Longtime User
Yes, I used this:

httpjob.download("http://www.xxxx.com/cgi-bin/movil?usuario=pepe&password=pepe")
msgbox(httpjob.getstring,"Titulo")

And the same result...

Please, can you post an little example how I can send parameters to CGI using httpjpg.download and (very important) how I can get the result string?.

Thanks!!
 
Upvote 0

JUAN CARLOSORDOÑEZ

Member
Licensed User
Longtime User
hi:

I have a cycle to save multiple records are recorded but only the first was recorder ok. What can be the cause. I have reviewed the cycle is done right and take consecutively the data for each item


For i = 0 To cursor_pedido.RowCount-1
cursor_pedido.Position=i
codigo=cursor_pedido.GetString2(4)
descripcion=cursor_pedido.GetString2(0)
cantidad=cursor_pedido.GetString2(1)
precio=cursor_pedido.GetString2(2)
cadena="http://xxxxx.com/itemspedido.php?
action=items"&"&pedido="&numero&"&codigo="&codigo&"&cantidad="&cantidad&"&precio="&precio&"&descripcion="&descripcion
cadena=cadena.Replace(" ","_")
itemspedido.Initialize("itemspedido", Me)
itemspedido.download(cadena)
Next


thanks!!
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
B4X:
For i = 0 To cursor_pedido.RowCount-1
  cursor_pedido.Position=i
  codigo=cursor_pedido.GetString2(4)
  descripcion=cursor_pedido.GetString2(0)
  cantidad=cursor_pedido.GetString2(1)
  precio=cursor_pedido.GetString2(2)
  cadena="http://xxxxx.com/itemspedido.php?
  action=items"&"&pedido="&numero&"&codigo="&codigo&"&cantidad="&cantidad&"&precio="&precio&"&descripcion="&descripcion
  cadena=cadena.Replace(" ","_")
  dim itemspedido as httpjob ' Create a new job for each iteration instead of using ONE job
  itemspedido.Initialize("itemspedido", Me)
  itemspedido.download(cadena)
Next
 
Upvote 0

JUAN CARLOSORDOÑEZ

Member
Licensed User
Longtime User
DonManfred

Take your advice and it works perfect. Eternally grateful !!
I'm doing a month ago an application for foof delivery and is fully functional!! Need to do some things but Basic4android is wonderful and the support provided by you too. (Erel, You, Farias,etc,etc) Thank you very much !!

As my application will be for public use I'm developing with php scripts for security. I can implement transactions for ensure data integrity?

thank!!!!
 
Upvote 0
Top