Note that there are some explanatory texts on larger screens.

plurals
  1. POjson confusion
    primarykey
    data
    text
    <p>I have created and Android app that has to communicate with my website using JSON. JSON (on client, Android side) looks like this:</p> <pre><code>private static String JSONSend(Context ctx, JSONObject obj, String ObjName, String address) { IHttpDispatcher disp = new HttpDispatcher(); Vector&lt;String&gt; ss = new Vector&lt;String&gt;(); String link = address; String locale = uzmiLocale(ctx); if(locale=="") return ""; try { obj.put("Lokal", locale); ss.add(ObjName + obj.toString()); String ID = disp.getHttpResponse_POST(link, ss); return ID; } catch (Exception e) { return ""; } } </code></pre> <p>Above method is called from here:</p> <pre><code>public static String sendReq(Context ctx, String txt, String number) { JSONObject jsn = new JSONObject(); try { jsn.put("TextPoruke", txt); jsn.put("BrTel", number); return JSONSend(ctx, jsn, "JSNSend=", "www.mysite.com"); } catch (JSONException e1) { return ""; } } </code></pre> <p>Everything works fine on my Wamp server, but after moving my php code to webserver, nightmare started! Apparently, everything is sent the way it should be,but on serverside this php code is creating problems:</p> <pre><code>if(isset ($_POST['JSNSend'])) { $argument = $_POST['JSNSend']; $json = json_decode($argument,true); $broj = $json['BrTel']; $jsnLocale = $json['Lokal']; </code></pre> <p>it seems that result of "json_decode" is NULL, but $argument equals </p> <pre><code>{"\TextPoruke\": \"sometext\", \"BrTel\":\"111\"} </code></pre> <p>So passed JSON string seems ok, but for some reason it can't be decoded on webserver. Can anyone help me with this? Why it's not working?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload