$key, 'contacts' => $destination, 'senderid' => $sender, 'msg' => $message, 'responsetype' => 'json', ]); $separator = parse_url($url, PHP_URL_QUERY) ? '&' : '?'; $url_final = $url . $separator . $params; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url_final); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($response === false || $httpCode >= 400) { return false; } return true; } }