Posts marked with "PHP" in categories

How To Download & Extract Zip Archives in PHP

If you used WordPress before, you know that when you do plugin installation action, WordPress automatically downloads and extract the plugin zip file. If you’re app needs something like this, you will find this post useful. PHP has the Zip Archive Extension. You can see the php manual for installing ZipArchive Extension. The usage of ZipArchive extension is very easy. Download For downloading, we will use cURL. First we create a blank zip file, download the zip file from server and put it’s contents to the blank zip file we created.... [READ MORE]

Get Absolute Directory Path of Current File in PHP

If your code is including other files, you will encounter problems like “The file is not found”. This is because, PHP doesn’t know the absolute path of file. So, if you are including files on another file, you should mention the absolute path of file. But, If you’re PHP application is being used by other people, then the absolute path which you mentioned in your system won’t be the one of the others’ systems.... [READ MORE]

Check If A String Is JSON in PHP

In my previous post, I gave the isHTML function that returns if a string is HTML or not. In this post, I will give you a simple function of different ways that helps in the detection of valid JSON string in PHP. The function I’m giving are fast, easy and doesn’t take up too much CPU memory. Demo Method 1 JSON (JavaScript Object Notation) can be made in to a PHP object using json_decode.... [READ MORE]

Check If A String Is HTML In PHP

HTML detection can be hard, because HTML is complicated and there aren’t any good 100% parsers for HTML. RegEx won’t help you in detection, so you need something else. The trick to identify HTML which I’m gonna show you is very easy. It’s fast, short and doesn’t use RegEx. You can simply use an if statement to check if a string is HTML or not. Demo PHP’s strip_tags function when given a string, it returns a string that doesn’t have any HTML / PHP characters (according to the manual).... [READ MORE]

Disable jQuery Migrate Loading In WordPress Blog

If you run a WordPress blog with all the new stuff (functions) and still WordPress loads the jQuery Migrate on your blog, you will be angry (I know hot it feels). The jQuery Migrate file’s minified version is about 7 KB and the unminified version is about 17 KB. That’s a file you don’t need if your blog’s jQuery functions aren’t deprecated. What’s jQuery Migrate ? jQuery Migrate is a JavaScript file that adds the jQuery deprecated functions to the page which makes us to use the deprecated functions of jQuery.... [READ MORE]

Configure WordPress To Not Use FTP To Do Stuff

By default, if you want to install plugins or upgrade WordPress, you have to provide the FTP details. If you are running WordPress on localhost, you won’t have the FTP credentials. In this case you won’t be able to install plugins or upgrade WordPress. There is a way to configure WP to don’t use FTP, instead install directly using the Read/Write permission of folder. If WordPress can’t install anything without FTP, it needs another method – direct install.... [READ MORE]

Load Data While Scrolling Down With jQuery & PHP

If your site have a lot of data to display on a page, it will make the page laggy. With this tutorial, you can limit the data on the main page and load new data when user reach the bottom of the page. This makes it easy to show huge data in a single page. Before user reaches the end of page. After user reaches the end of page. Demo jQuery will trigger a POST request when user reaches the end of the page.... [READ MORE]

Create A Trending Box In PHP With MySQL & HTML

Trending boxes can be seen is social networks. Facebook, Twitter, Google + have it. Why not create one of your own. You can create your own using HTML and add styling by CSS. We will use PHP for updating most searched queries in MySQL database. Demo How the trending box looks like : Trending Box We need a table for storing the search queries. For this we are going to create a table named “trends”.... [READ MORE]

Send E-Mails Via SMTP Server In PHP – GMail & Outlook

Email Service providers have POP and SMTP servers for incoming and outgoing E-Mails. SMTP is for Outgoing (Sending) emails and POP is for Incoming (Receiving) emails. If you have an account in email services, it means that you can send or receive emails using these servers. This service is free, fast and secure. You can change the “From” address and the “From” name if you send emails using SMTP server. In this post I will tell you how to send emails using SMTP servers of GMail & Outlook in PHP.... [READ MORE]

Add Pagination To MySQL Database Result In PHP

Pagination makes the results tidy and simple. When there are many results, pagination helps sorting them out and adding each results to specific pages. In PHP, it’s real simple. You can use this tutorial to add a pagination to your database results in PHP. Demo We will be using PDO for database connection and queries. The Database table named “users” is like this : id <td> First_Name </td> <td> Last_Name </td> 1 <td> Subin </td> <td> Siby </td> 2 <td> Peter </td> <td> Charles </td> 3 <td> Thomas </td> <td> Chacko </td> It contains more and more data.... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab