Skip to main content

Posts

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(...

Stripe payment gateway integration using cUrl - Codeigniter 3

  Stripe payment gateway integration using cUrl - Codeigniter 3 Sign up for a Stripe account at https://stripe.com/ Obtain Stripe api key Setup Codeigniter 3 Project Create a library for Stripe integration Create library inside libraries folder   application => libraries => Stripe_library.php <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Stripe_library { protected $CI; // Default Constructor public function __construct() { $this->CI =& get_instance(); // Load necessary libraries and helpers here if needed } // Create function for checkout public function create_checkout_session($amount, $currency, $success_url, $cancel_url) { $stripe_secret_key = 'Stripe_secret_key'; $api_url = 'https://api.stripe.com/v1/checkout/sessions'; $stripeamount = $amount * 100; $data = [ 'payment_method_types' => ['card'], ...

Building Dynamic Web Applications with CodeIgniter 3

Introduction:                                 CodeIgniter 3 is a powerful PHP framework that simplifies web application development. Its simplicity and flexibility make it a popular choice among developers for creating dynamic and robust web applications. In this blog post, we'll explore some essential concepts and features of CodeIgniter 3 and show you how to get started with building your web applications.  Installation and Setup:   Begin by downloading and installing CodeIgniter 3.  Configure your development environment (e.g., Apache, MySQL, PHP).  Create a new CodeIgniter project structure.  Model-View-Controller (MVC) Architecture:  Understand the MVC design pattern used in CodeIgniter.  Learn how to structure your application using models, views, and controllers.  Explore the benefits of separating application logic.  Routing and URLs:  ...

Server side datatable using codeigniter 3

  What is server side datatables? Server side datatables are used to show large data sets. Advantage of server side datatables. Data processing will be server side. Show large data sets. Server-side rendering is better for SEO than client-side rendering, as it can speed up the loading time of your page, improving user experience and helping your site rank higher in Google search results. Using server-side rendering here has the benefit of keeping the information on the server-side and not delivering it to the client, even if you pull from relational databases or NoSQL stores. HTML Code <div class="tab-pane fade show active" id="tab10">           <section class="main--content" style="padding:0px;" >                 <div class="panel">                  ...

Codeigniter Login Form using Ajax: Codeigniter Club

Codeigniter login form with validation using Ajax In this tutorial, we will understand how to create a simple login form using Codeigniter.  Create database table using Mysql database create login table in mysql database. Just copy paste query in Mysql database. CREATE TABLE `login` ( `id` int(11) NOT NULL, `user_id` int(25) NOT NULL, `session` varchar(10) NOT NULL, `system_ip` varchar(100) NOT NULL, `login_at` datetime NOT NULL DEFAULT current_timestamp(), `logout_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; Create view create a file in view folder with the name of  loginpage.php . <div class="container-scroller"> <div class="container-fluid page-body-wrapper full-page-wrapper"> <div class="content-wrapper d-flex align-items-center auth px-0"> <div class="row w-100 mx-0"> <div cl...

How to secure codeigniter website?

CSRF Protection (Cross-Site Request Forgery) CSRF process of an attacker tricking their victim into unknowingly submitting a request. CodeIgniter provides CSRF protection out of the box, which will get automatically triggered for every non-GET HTTP request, but also needs you to create your submit forms in a certain way. URI Security CodeIgniter contain following character in URI ·          Alpha-numeric text (Latin characters only) ·          Tilde: ~ ·          Per cent sign: % ·          Period: . ·          Colon: : ·          Underscore: _ ·          Dash: - ·          Space Password Handling ·        ...

MVC (Model View Controller) : Codeigniter Club

MVC will divide an application into three functional parts: Models  — deals with your database, carries out computations, and more. In short, it is where your business logic is located. Views  — forms the presentation layer of the application, where the data from your  models  are embedded. Controllers  — used to connect  models  and  views . A controller will route user requests to the appropriate  model.  After that, once the model has done its job, the controller loads the relevant  view. This architectural pattern also gives developers the flexibility to reuse code for multiple views. For example, you can apply the same navigation bar on every webpage of your application. Moreover, as both  views  and  models  are entirely separate, the front-end developers can work in parallel with the back-end team to speed up the development process. Note that CodeIgniter also subscribes to  Object-Oriented Programmin...