How to call json from php
<p>I have written a php code that should print the response of a json call. But I am getting NULL output. I have checked my json call is working fine from a restclient.</p>

<p>Here is my code</p>

<pre><code>&lt;?php

    $username = "user";
    $password = "password";

    $postData = array(
            'username' =&gt; $username,
            'password' =&gt; $password,
            'msisdn' =&gt; "111111111"
            );

    $ch = curl_init('http://ip:&lt;port&gt;/xxx/yyy/zzz');

    curl_setopt_array($ch, array(
    CURLOPT_POST =&gt; TRUE,
    CURLOPT_RETURNTRANSFER =&gt; TRUE,
    CURLOPT_HTTPHEADER =&gt; array(
        'Content-Type: application/json'
    ),
    CURLOPT_POSTFIELDS =&gt; json_encode($postData)
    ));

    // Send the request
    $response = curl_exec($ch);

    // Check for errors
    if($response === FALSE){
    die(curl_error($ch));
    }

    // Decode the response
    $responseData = json_decode($response, TRUE);

    // Print the date from the response
    echo $responseData['published'];

    var_dump($responseData);

    ?&gt;
</code></pre>

<p>Thanks in advance.</p>