hi
i have become a working PHP script.
now i have write in B4A:
Unfortunately it do not work
- i test on Android 5 System
- java.net.ConnectException: Failed to connect to ....... :443
Is it a SSL Problem or have i do another wrong thing??
i have become a working PHP script.
PHP:
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 4,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
PHP:
$url = "https://......../protocol/openid-connect/token";
// post
$post = array(
"client_id" => "watch",
"client_secret" => "",
"username" => $user,
"scope" => "openid",
"password" => $passwd,
"grant_type" => "password"
);
$json = curl_post($url,$post);
now i have write in B4A:
B4X:
Dim mPost As Map
Dim url_Token As String = "https://........./protocol/openid-connect/token"
Dim h_Spot_Token As HttpJob
mPost.Initialize
mPost.Put("client_id","watch")
mPost.Put("client_secret","")
mPost.Put("username",box_User.Text)
mPost.Put("scope","openid")
mPost.Put("password",box_Pass.Text)
mPost.Put("grant_type","password")
JSONGenerator.Initialize(mPost)
h_Spot_Token.Initialize("",Me)
h_Spot_Token.PostString(url_Token,JSONGenerator.ToString)
h_Spot_Token.GetRequest.SetContentType("application/json;charset=UTF-8")
Wait For (h_Spot_Token) JobDone(h_Spot_Token As HttpJob)
If h_Spot_Token.Success = True Then
Log(h_Spot_Token.GetString)
Else
Log(h_Spot_Token.ErrorMessage)
End If
Unfortunately it do not work
- i test on Android 5 System
- java.net.ConnectException: Failed to connect to ....... :443
Is it a SSL Problem or have i do another wrong thing??
Last edited: