Please help me out with the code
- 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 true which comes after the {"success":"
{"success":"true","type":"API","totalprice":"1","totalgsm":"1","remaincredit":"491 SMS","results":[{"status":"OK","messageid":"263db4bc-321f-5d2e-8d3a-454bf0d2bda2","gsm":"923100000003"}]}
Here in my php code I want to have it checked if the value is returned as true it should run the first if statment and if the value is returned as false it should run the else statement.
$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 = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Messages successfuly sent to '.$cnt.' Students.</strong> </div>'; $status = 'Success'; }else{ $alert = '<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <strong>Message Sending Failed.</strong> </div>'; $status = 'Failed'; }