Create rest api to send curl request from codeigniter controller to google cloud for text to speech convert using codeigniter 3.
Create Google Cloud account https://cloud.google.com/ You can create account using existing mail id. Obtain api key for Text to Speech. Create Rest Api to convert text to speech. We are using cUrl method to send a request. Create Api.php and extend REST_Controller <?php defined('BASEPATH') OR exit('No direct script access allowed'); require APPPATH . '/libraries/REST_Controller.php'; class Api extends REST_Controller{ public function __construct(){ parent::__construct(); } public function index_get() { $text = "Hi, how are you doing? Very well thank you. How about you? Not so well. But thank you for asking. How is the weather there? Oh, its very warm out here."; $audioContent = $this->generateSpeech($text); $this->response(array( "status" => 1, "message" => "question 1", "data" => $audioContent ), REST_Controller::HTTP_OK); } private function generateSpeech(...