Android Question HttpUtils2 - Web services & BASIC auth

luke2012

Well-Known Member
Licensed User
Longtime User
Hi all,
is there a test server where I can test the BASIC authentication using a POST ?

B4X:
job3.Initialize("Job3", Me)
job3.Username = "xxx"
job3.Password = "yyy"
job3.PostString("http://www.example.com", "key1=val1&key2=val2")
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
but it does only GET requests, so not that helpful for the original question...:(
right

Check http://donmanfred.basic4android.de/images/?var1=test
(or even with post)
Username: b4a
Password: b4xb4x
PHP:
<?php
header('Content-type: text/plain; charset=UTF-8');
if(sizeof($_REQUEST) > 0){
  foreach($_REQUEST as $name => $value){
    echo date("d.m.Y H:i:s", time()).": ".$name."=".$value."\r\n";
  }
}
?>
 
Last edited:
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
right

Check http://donmanfred.basic4android.de/images/?var1=test
(or even with post)
Username: b4a
Password: b4xb4x
PHP:
<?php
header('Content-type: text/plain; charset=UTF-8');
if(sizeof($_REQUEST) > 0){
  foreach($_REQUEST as $name => $value){
    echo date("d.m.Y H:i:s", time()).": ".$name."=".$value."\r\n";
  }
}
?>

@DonManfred Basic Authentication work fine. I did a test:

Wow! My first web service call using B4A :)

B4X:
Dim j1 As HttpJob
j1.Initialize("j1", Me)
j1.Username = "b4a"
j1.Password = "b4xb4x"
j1.PostString("http://donmanfred.basic4android.de/images/?var1=test", "")

'Result from log: 12.09.2017 18:44:41: var1=test
 
Last edited:
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
you did not post anything... the post is empty
The value you are given is given with GET parameter

I updated the test code (it works fine):

B4X:
j1.PostString("http://donmanfred.basic4android.de/images/", "var1=test1&var2=test2")

Web Service response:
13.09.2017 10:42:16: var1=test1
13.09.2017 10:42:16: var2=test2

I'm testing the authentication and if the web service gets and process the passed parameters correctly.
 
Last edited:
Upvote 0
Top