Пример #1
0
 // Will return the response, if false it print the response
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 // Set the url
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_POST, count($fields));
 curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
 // Execute
 $result = curl_exec($ch);
 // Closing
 curl_close($ch);
 $json = json_decode($result, true);
 if ($json && $json['status'] == 'success') {
     switch ($json['type']) {
         case 'Play':
             $response->Play($json['msg']);
             $response->Redirect($next);
             break;
         case 'Sms':
             $response->Sms($json['msg']);
             $response->Redirect($next);
             break;
         case 'Dial':
             $response->Dial($json['msg']);
             $response->Redirect($next);
             break;
         case 'Hangup':
             $response->addHangup();
             break;
         case 'Say':
         default:
             $response->Say($json['msg']);