PHP print JSON specific value : <p>In my code I want to print a specific value i.e. <code>ticket</code> from JSON data but when I do it I got <code>Notice: Trying to get property of non-object</code> error every time I don't know what I am doing wrong in it</p>

<p>Here is my JSON array dump</p>

<pre><code>array(3) {
  ["status"]=&gt;
  int(200)
  ["msg"]=&gt;
  string(2) "OK"
  ["result"]=&gt;
  array(6) {
    ["ticket"]=&gt;
    string(79) "w-_xdRcVDJQ~55de39b726745a28~1505246565~def~FzuGpPpNoQEus6lK~1~Dhyp8PJM83-pMwAe"
    ["captcha_url"]=&gt;
    string(50) "https://myurl.com/images/FzuGpPpNoQEus6lK.png"
    ["captcha_w"]=&gt;
    int(160)
    ["captcha_h"]=&gt;
    int(70)
    ["wait_time"]=&gt;
    int(0)
    ["valid_until"]=&gt;
    string(19) "2017-09-12 20:17:46"
  }
}
</code></pre>

<p>Here is my PHP Code</p>

<pre><code>$response = file_get_contents($url);
$obj = json_decode($response, TRUE);
$printjson = $obj-&gt;result-&gt;ticket;
echo $printjson;
</code></pre>
