Ohanian Active Member Licensed User Longtime User Feb 22, 2014 #1 Hi, i'm trying to post some data to a webservice, this html code works fine : B4X: <html> <head> <META http-equiv="Content-Type" content="text/html"> </head> <body> <div> <form action="http://URL/androidOutput.php?sn=login" method="post"> <input type="text" name="submit_login" value="1"> <input type="text" name="username" value="NAME"> <input type="text" name="password" value="PASS"> <input type="submit" value="Go"> </form> </div> </body></html> but i can't me it work in b4a with this code : B4X: Job1.Initialize("Login", Me) Job1.PostString("http://URL/androidOutput.php?sn=login", "submit_login=1&username=NAME&password=PASS") Job1.ContentType = "text/html" Job1.GetRequest.SetHeader("User-Agent", " Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0") any suggestion?
Hi, i'm trying to post some data to a webservice, this html code works fine : B4X: <html> <head> <META http-equiv="Content-Type" content="text/html"> </head> <body> <div> <form action="http://URL/androidOutput.php?sn=login" method="post"> <input type="text" name="submit_login" value="1"> <input type="text" name="username" value="NAME"> <input type="text" name="password" value="PASS"> <input type="submit" value="Go"> </form> </div> </body></html> but i can't me it work in b4a with this code : B4X: Job1.Initialize("Login", Me) Job1.PostString("http://URL/androidOutput.php?sn=login", "submit_login=1&username=NAME&password=PASS") Job1.ContentType = "text/html" Job1.GetRequest.SetHeader("User-Agent", " Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0") any suggestion?
DonManfred Expert Licensed User Longtime User Feb 22, 2014 #2 how look your androidOutput.php like? Please post it here... This should work when you getting the parameters from $_GET inside the php B4X: Dim job As HttpJob job.Initialize(JobName, Me) job.download2("http://domain/androidoutput.php", Array As String( _ "submit_login", "1", _ "username", "NAME", _ "password", "PASS", _ "sn", "login", _ )) Last edited: Feb 22, 2014 Upvote 0
how look your androidOutput.php like? Please post it here... This should work when you getting the parameters from $_GET inside the php B4X: Dim job As HttpJob job.Initialize(JobName, Me) job.download2("http://domain/androidoutput.php", Array As String( _ "submit_login", "1", _ "username", "NAME", _ "password", "PASS", _ "sn", "login", _ ))
Ohanian Active Member Licensed User Longtime User Feb 23, 2014 #3 DonManfred said: how look your androidOutput.php like? Please post it here... This should work when you getting the parameters from $_GET inside the php B4X: Dim job As HttpJob job.Initialize(JobName, Me) job.download2("http://domain/androidoutput.php", Array As String( _ "submit_login", "1", _ "username", "NAME", _ "password", "PASS", _ "sn", "login", _ )) Click to expand... Hi, i don't have access to the source code. they said that i have to use the post method, and as i mentioned in the html code i have to set the Content-Type to text/html, when i remove that tag from the html code, the html code fails too. Upvote 0
DonManfred said: how look your androidOutput.php like? Please post it here... This should work when you getting the parameters from $_GET inside the php B4X: Dim job As HttpJob job.Initialize(JobName, Me) job.download2("http://domain/androidoutput.php", Array As String( _ "submit_login", "1", _ "username", "NAME", _ "password", "PASS", _ "sn", "login", _ )) Click to expand... Hi, i don't have access to the source code. they said that i have to use the post method, and as i mentioned in the html code i have to set the Content-Type to text/html, when i remove that tag from the html code, the html code fails too.
Erel B4X founder Staff member Licensed User Longtime User Feb 23, 2014 #4 I guess that Job1.ContentType is actually Job1.GetRequest.SetContentType, right? Upvote 0
Ohanian Active Member Licensed User Longtime User Feb 23, 2014 #5 Erel said: I guess that Job1.ContentType is actually Job1.GetRequest.SetContentType, right? Click to expand... Hi, this is the code : B4X: Job1.Initialize("Login", Me) Job1.PostString("http://URL/androidOutput.php?sn=login", "submit_login=1&username=USER&password=PASS") Job1.GetRequest.SetContentType("text/html") Job1.GetRequest.SetHeader("User-Agent", " Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0") Upvote 0
Erel said: I guess that Job1.ContentType is actually Job1.GetRequest.SetContentType, right? Click to expand... Hi, this is the code : B4X: Job1.Initialize("Login", Me) Job1.PostString("http://URL/androidOutput.php?sn=login", "submit_login=1&username=USER&password=PASS") Job1.GetRequest.SetContentType("text/html") Job1.GetRequest.SetHeader("User-Agent", " Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0")
Erel B4X founder Staff member Licensed User Longtime User Feb 23, 2014 #6 Your code looks correct. Use FireBug to see the exact request that is sent from the browser. Upvote 0