What Is PHP Session?

Definition :- A session is use to store details of a user across multiple pages. Session is technique to recognized a user from single page to all pages in one application. How the php session works :- When you open a website on browser, its create a session variable to store your information’s until you close the application.  Your system knows who you are. It knows the time when you start the application and when you close it.  Mostly when someone login to a website, as per programming it create a…

Send Get / Post Data Using PHP CURL

In this tutorial, I am explaining How to send Get / Post PHP  curl Request with Parameters .   I am explaining 3 types of curl request with an example of S2S communication. #PHP Simple cUrl  Request Without Parameter. You can use below code to send CURL request with parameter. <?php $AffPostbackUrl = ‘https://phpmypassion.com’; curl_request($AffPostbackUrl); function curl_request($url, array $options = array()) { $defaults = array( CURLOPT_POST => 0, CURLOPT_HEADER => 0, CURLOPT_URL => $url, CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 0, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 4 ); $ch = curl_init(); curl_setopt_array($ch,…

How To Generate And Download A Dynamic Excel Sheet Using PHP ?

I have got lot of queries regarding to generate an excel sheet and download that on the system using PHP. So I thought to share the proper solution with an article. You can download an excel by using two process. either you can use function to download excel sheet or you can use PHP code on the same page to download a dynamic excel sheet. So here I am going to describe both the process. you can use according to your ease. #Process 1: Download an excel using PHP script…

How To Reverse A String In PHP ?

Commonly in interview we have been asked about reverse a string. So here I am going to share the solution for this type of question with my article. Image source : google images This is a basic question but most of the developers are stuck in it due to hesitation of interview. Interviewer only want to ask the main logic to reverse a string. He can either ask the function in php to reverse a string or also ask about procedural logic behind this. You can reverse a string using…

How To Remove Case Sensitiveness Issue From Post Link In WordPress?

Resolving Case Sensitivity Issues in WordPress Post Links When updating a post in WordPress, you may notice that the post link (permalink) is automatically converted to lowercase, even if it originally contained a mix of uppercase and lowercase letters. This article explains why this happens and provides a solution to preserve case sensitivity in post links. The Issue The case sensitivity issue arises due to the sanitize_title() function in WordPress, located in the wp-includes/formatting.php file. This function processes the post title to generate a URL-friendly slug, converting it to lowercase…

How To Create Random URL .txt File From Sitemap.xml In PHP ?

Here I am sharing a simple PHP script to generate number of txt file from Sitemap.xml. This is a simple PHP script I wrote quickly for myself to create number of .txt files according to length of sitemap.xml for my page. This script will help you If you want to generate random .txt file from the URL existed in sitemap.xml. Follow the steps to generate random URL .txt file : Step #1 : Generate & Download sitemap.xml for your website. There are number of websites where you can generate sitemap.xml…

Best Interview Questions And Answers For Experienced PHP Developer

Question #1: How to get the location of php.ini? You can get the location of php.ini by using <?php phpinfo(); ?> code. Question #2: How to POST Data using CURL in PHP? you can execute POST data by using CURL as below : $data = array(‘name’ => ‘Ross’, ‘php_master’ => true); $url = ‘http://domain.com/abc.php’; // You can POST a file by prefixing with an @ (for <input type=”file”> fields) $handle = curl_init($url); curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURLOPT_POSTFIELDS, $data); curl_exec($handle); curl_close($handle); Question #3: How to get duplicate values from array? you can get…

How To Insert Records Using Stored Procedure in MySql with PHP ?

If you want to insert large records in a table so it is great to do that by using of Stored Procedure. There are number of benefits to insert record with the use of Stored Procedure Stored procedure cached on server so the speed is more fast.  A Stored Procedures will be in one place so that there’s no confusion of having business rules spread over potentially disparate code files in the project. More secure because there is no direct access with tables in database. I am describing the process…

How to Get Title, Description, and Keywords of a Website in PHP ?

I found most of the people asking for a way to get meta data of a website, so I thought to share the logic with a very easy PHP script that will retrieve a website page title, keywords and description. You can also get the sitemap of a website url. Here I am describing it with proper UI and with output. So follow these steps. Step #1 : First design a page where you can input website URL. Copy index.php Code :- <form action=”show.php” method=”POST”>     <table cellspacing=”0″ height=”38%”…

How to Create a Simple Stored Procedure in mysql?

What is a Stored Procedure? A stored procedure is a set of SQL statements that form a logical unit to perform a specific task. It encapsulates a group of operations or queries executed on a database server. Why Use Stored Procedures? Stored procedures isolate the client from implementation details and the underlying schema. They also reduce network traffic by executing SQL statements in batches, minimizing multiple client requests. Syntax: DELIMITER $$ CREATE PROCEDURE `simpleprocedure`(IN name varchar(50), IN user_name varchar(50), IN branch varchar(50)) BEGIN INSERT INTO student (name, user_name, branch) VALUES…