Android Question httputils2 problem sending parameters

santiago

Member
Licensed User
Longtime User
First , I beg your pardo if exists an open thread about this area.

I am using OKhttputils2, but I tried before with httputils2 lib.

I have a php file .Its requires 2 parameters .
When I use bronwser and I type on it

http://domain.com/ted1.php?ticket=55&nif=33 I have this answer
holllaArray ( [ticket] => 55 [nif] => 33 ) Array ( [ticket] => 55 [nif] => 33 ) ticket 55 nif 33
in my php page I wrote

<?php
echo "hollla";
print_r($_GET);
print_r($_REQUEST);
$nif=$_GET["nif"];
$ticket=$_GET["ticket"];
echo "ticket ".$ticket." nif ".$nif;
... and more

If I uses httputils I wrote this

job1.Initialize("Job1", Me)
job1.PostString("http://" & ip & "/ted1.php", Array As String("ticket", "55", "nif", "33"))


and I received (using Job.Getstring on the JobDone-Job.Sucess ) this string

holllaArray()Array()

I read this way ,using an array ,working fine for everybody.

Its LIKE I AM NOT SENDING PARAMETERS AT ALL .
I tried several ways to send the parameters data
job1.PostString("http://" & ip & "/ted1.php", "ticket=55&nif=33) without success .

Please, what I am doing wrong?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

santiago

Member
Licensed User
Longtime User
Thanks .
I used job1.download2 with the same data and it works fine.
job1.download2("http://" & ip & "/ted1.php", Array As String("ticket", "55", "nif", "33"))
I think I did not understood the tutorial I read about this httputils2

But , I had this problem , with the original code

job1.PostString("http://" & ip & "/ted1.php", Array As String("ticket", "55", "nif", "33")), using $_POST instead $_GET in the php page, I did not take any valor.

Could somebody tell my why?

Thanks in advance
 
Upvote 0

karld

Active Member
Licensed User
Longtime User
I may be off base as I don't use that function...

But
Shouldn't this
B4X:
job1.Initialize("Job1", Me)
job1.PostString("http://" & ip & "/ted1.php", Array As String("ticket", "55", "nif", "33"))

Be this?
B4X:
job1.Initialize("Job1", Me)
job1.PostString("http://" & ip & "/ted1.php?", Array As String("ticket", "55", "nif", "33"))

I am rusty with php....
 
Upvote 0

santiago

Member
Licensed User
Longtime User
Thanks for previous responses.

Now I have this problem.Maybe somebody can help me.


I have this variables (all string variables) and its values

billete = "e3eeeee"
dia1="2016/01/01"
hora="10:00:00"
horay="12:00:00"
po=1
pd=2
barco=3

job1.Initialize("Job1", Me)
job1.Download2("http://" & ip & "/ted1.php", Array As String("ticket", billete,"fecha",dia1,"hora",hora,"horay",horay,"po",po,"pd",pd,"barco",barco,"emp",emp))

When I try this code, application CRASH.

Where is the mistake? Maybe for use variables value like "2016/01/01" or "12:00:00" that includes / or :

And if the problem is that-using / or : - , how can I solve ?
Thanks in advance. Any help is wellcomed
 
Upvote 0

fixit30

Active Member
Licensed User
Longtime User
When I try this code, application CRASH

What is the error that you are getting in the logs?

Your code above does not make any mention of the value of the variable emp

Httputils2 would normally url encode any illegal characters.
 
Upvote 0

santiago

Member
Licensed User
Longtime User
Sorry. I beg your pardon. Application CRASH for another issues. Sentences I wrote are working properly.
I investigate with any variable and I found the problem at a different operation

Thanks
 
Upvote 0
Top