Android Question okhttputils problem for get json

NaimSadghi

Member
Hi, I have problem getting json from my api.
this is based on this tutorial ---> [B4X] OkHttpUtils2 with Wait For

I do everything like that until Minutes 4
My code is
my code:
Sub Button1_Click
    
    Dim j As HttpJob
    j.Initialize("",Me)
    j.Download("http://sadghi.ir/wp-json/wp/v2/posts")
    Wait For (j) Jobdone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
        Label1.Text = j.GetString
        
    Else
        Log("error")   
    End If
    j.Release
    
End Sub

and the log I give is
B4X:
<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("7d1672005eef9d7a31b65f4090bda13b");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://sadghi.ir/wp-json/wp/v2/posts?i=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>


can you help me to fix it?

(Forgive me for my weak language)
 

MarcoRome

Expert
Licensed User
Longtime User
Strain with your same code i have json response:

1608118827635.png
 
Upvote 0

NaimSadghi

Member
Are you trying to access to your server into your own local network, with the external address?


No, in fact, I bought a host and a domain and use it to develop my app

In general, it works well in browsers, but it has problems when sending requests from the software.
I know well in web develop and I know my web codes are Absolutely right
 
Upvote 0

Similar Threads

Top