Android Question Get Array result php

Douglas Farias

Expert
Licensed User
Longtime User
hi i made login with google on php

when you log on on this link

https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http://www.clickfight.com.br/google/&client_id=1027389441775-erqhdb52b29eijrrgrnpuenqgp90jvj8.apps.googleusercontent.com&scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email&access_type=online&approval_prompt=auto


this return this result

Array
(
[id] => 109691273181171171967
=> [email protected]
=> 1
[name] => Douglas Eduardo Farias
[given_name] => Douglas
[family_name] => Eduardo Farias
[link] => https://plus.google.com/109691273181171171967
[picture] => https://lh5.googleusercontent.com/-_KZutqDhFHE/AAAAAAAAAAI/AAAAAAAABo0/KbETSR-tEPQ/photo.jpg
[gender] => male
[locale] => pt-BR
)


ok but how can i get this result?

i m trying to use job getstring or get download but it dont return nothing o_O
why?

in my php code i show this with
echo '<pre>';
print_r($user);
echo '</pre>';


i tested make a echo 'aaaa';

and it return on my job but my array with informations no o_O

HOW TO GET MY ARRAY VALUES?
 

DonManfred

Expert
Licensed User
Longtime User
use json_encode and return your array as json

PHP:
<?php
$arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
echo json_encode($arr);
?>
make sure you only echo this one command, not more.

In jobdone you then can use the jsonstring and get the values from it with jsonparser
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
@DonManfred you know why this return null for me?

B4X:
  If Url.Contains("http://www.clickfight.com.br/google/") Then
    'webviewlogin.Visible = False
    jobgoogle.Initialize("resposta",Me)
    jobgoogle.Download(Url)
    End If


Sub JobDone (Job As HttpJob)
If Job.Success Then

    Select Job.JobName

    Case "resposta"
  respostadogoogle = Job.GetString
  Msgbox(respostadogoogle,"lala")
    Job.Release
    End Select
End If
End Sub



i see this on web view on app


{"id":"109691273181171171967","email":"[email protected]","verified_email":true,"name":"Douglas Eduardo Farias","given_name":"Douglas","family_name":"Eduardo Farias","link":"https:\/\/plus.google.com\/109691273181171171967","picture":"https:\/\/lh5.googleusercontent.com\/-_KZutqDhFHE\/AAAAAAAAAAI\/AAAAAAAABo0\/KbETSR-tEPQ\/photo.jpg","gender":"male","locale":"pt-BR"}

and i try download this with job but return "" null o_O
 
Last edited:
Upvote 0
Top