title: Getting a value from the JSON String
body: <p>Please help me out with the code </p>
  
  <ol>
  <li>I am getting the below result after I run my script which is working perfectly but I want to know how can I extract the value <strong>true</strong> which comes after the {"success":" </li>
  </ol>
  
  <blockquote>
    <p>{"success":"true","type":"API","totalprice":"1","totalgsm":"1","remaincredit":"491 SMS","results":[{"status":"OK","messageid":"263db4bc-321f-5d2e-8d3a-454bf0d2bda2","gsm":"923100000003"}]} </p>
  </blockquote>
  
  <ol start="2">
  <li><p>Here in my php code I want to have it checked if the value is returned as <strong>true</strong> it should run the first if statment and if the value is returned as <strong>false</strong> it should run the else statement. </p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $cpurl);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  $result = curl_exec ($ch);
  
  if (preg_match("/successfully/", $result ))
  {
  $alert = '&lt;div class="alert alert-success"&gt;
                                      &lt;button type="button" class="close" 
  data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
                                      &lt;strong&gt;Messages successfuly sent to 
  '.$cnt.' Students.&lt;/strong&gt;
                                  &lt;/div&gt;';
                                  $status = 'Success';
  
  }else{
    $alert = '&lt;div class="alert alert-danger"&gt;
                                      &lt;button type="button" class="close" 
  data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
                                      &lt;strong&gt;Message Sending Failed.&lt;/strong&gt;
                                  &lt;/div&gt;'; 
                                  $status = 'Failed';
  }
  </code></pre></li>
  </ol>