PHP Code Samples

Recent Tutorial

PHP Google OAuth Login

June 22, 2014
PHP Google OAuth API allows users to login in a website with their Google credentials. A user with a Google account need not remember yet another username/password for a web application. This PHP tutorial is to learn about setting up an authentication system for your custom web application using Google OAuth. In an earlier tutorial, […]
This tutorial was added to PHP.

Send Email in PHP using Gmail SMTP

December 5, 2013
In this tutorial, let us see how to send email in PHP using PHPMailer library via Gmail SMTP. Sending email in PHP can be done with various mail transfer libraries available. For example,  PHPMailer, PEAR::Mail interface. These libraries provide advanced features like SMTP authentication and more. Sending an email with PHP’s core function mail() is […]
This tutorial was added to PHP.

Facebook Open Authentication in PHP

October 28, 2013
Open authentication is for providing access to the server resources after authorizing users via third party services. It will take place between open authentication providers and websites implementing open authentication. In this tutorial, we are going to see about implementing Facebook open authentication with our website using PHP. We can achieve this login mechanism using […]
This tutorial was added to PHP.


October 18, 2013
cURL – Client URL library is used to communicate with different type of servers with protocols FTP, HTTP, telnet, gopher and more. In PHP, we have to install libcurl library for using cURL function. If we used any one of AMP bundle like XAMPP, to create PHP environment, then the cURL library will come up […]
This tutorial was added to PHP.

PHP Change Password Script

September 15, 2013
Change password feature in a web application is to let the user change their old password at some periodic interval. It makes the user protect the sensitive pages from hackers. Some web application fixes some expiration period for user’s password. It forces the user to change the password once the expiration period is elapsed. For […]
This tutorial was added to PHP.

PHP Login Script with Session

July 22, 2013
In this tutorial, let us see how we can implement authentication using a standard login form with session handling. Most of the website will have login script to provide user authentication. I will present you an example PHP code to implement authentication using a login script. With authentication, we can protect our website by filtering genuine […]
This tutorial was added to PHP.

PHP Mail

June 4, 2013
PHP provides mail() function for sending simple mail using PHP scripts. For that, the mail() function requires three arguments compulsorily and also two optional arguments, so totally five possible arguments as shown below. Recipient Email Address (Mandatory). Email Subject (Mandatory) Email Context or Message Body (Mandatory) Additional Header Information (Optional) Additional Parameters (Optional) First three […]
This tutorial was added to PHP.

PHP AJAX Programming

May 8, 2013
AJAX can be expanded as  Asynchronous Javascript and XML and it is a method to request a server side script to execute via javascript. This request is generated in a Javascript function and sent to a PHP file. In server side, PHP file it receives and processes the request passed through an AJAX call and send […]
This tutorial was added to PHP.

PHP User Authentication with MySQL

May 7, 2013
In this tutorial, we are going to see how to implement user authentication mechanism in PHP using MySQL. Authentication is used validate users entering into our website. It protects our website by preventing anonymous access and allows genuine users who clear authentication process. In this user authentication example, it has a login panel to let […]
This tutorial was added to PHP.

↑ Back to Top