Showing posts with label FREE. Show all posts
Showing posts with label FREE. Show all posts


 "You can always talk about the weather." It’s a cliched phrase, but regardless of a person’s personality, political views, or culture, the weather is a subject that anyone and everyone can talk about and find common ground. It’s the universal truth that binds humanity together.

But the weather is more than that—it’s a force that affects humanity on a grand scale. Hardly a day goes by where everyone doesn’t check, or at least know about, the weather so that they can be properly prepared for a given day. And, of course, there are few things more unifying to a people within the same region than experiencing the same weather—especially during major storms that sweep across a continent.

The weather is an important part of our daily lives, and while everyone can check their favorite smartphone app or local news, there are times when individuals and businesses need a bit more. For example:

  • Imagine a smart home that automatically turns on a bathroom heater on cold mornings before you wake up and get ready for work.
  • What if a business could automatically shut off the building’s water supply and drain its pipes if the overnight forecast predicts a hard freeze?
  • Think about municipalities that could send automated alerts to their citizens with real-time, up-to-date emergency alert data.

These types of applications need reliable and up-to-date weather information, and here is where the weatherstack API comes in. By using the weatherstack API, you can power your weather-based applications with accurate real-time, historical, and forecast data.

There’s a reason why weatherstack is trusted by over 75,000 companies worldwide: they can retrieve instant, accurate weather information for any location in the world.

What Is the weatherstack API?

weatherstack API

weatherstack is a RESTful API service that allows customers to query current, historical, and forecast weather for as many worldwide locations as possible. It covers an extensive scope of weather data for almost the entire planet, and it offers cost-effective plans for companies (both big and small), developers, and individuals.

The weatherstack API is powered by the highly scalable apilayer cloud infrastructure, making it capable of handling anything from hundreds of requests a month to millions of requests a minute. It has become one of the most popular weather data REST API providers thanks to its ease of integration and consistency.

With the weatherstack API, you can:

  • add localized weather to your website (using geolocation with ipstack)
  • build weather alert systems to notify users of extreme weather in their area
  • incorporate weather data into automated processes

Features: Why Use the weatherstack API?

Microsoft, Warner Brothers, Schneider Electric (think APC), and 74,997 other companies rely on weatherstack because it provides accurate and fast results. Let’s look at why:

Accurate Real-Time Weather

The weatherstack API delivers accurate real-time weather data thanks to licensing deals with some of the largest weather stations and providers in the world.

Broad Weather Data

weatherstack covers global weather data across the board—from a multi-year history to live information to accurate forecasts.

Millions of Locations

You can use the live or hour-by-hour weather data for millions of cities and locations worldwide.

Flexible Location Lookup

You can look up locations by city or region name, ZIP code, IP address, or traditional latitude and longitude coordinates.

Speed and Lightweight Response

The weatherstack API is lightning fast, delivering weather data in a lightweight JSON format.

Bank-Level Security

weatherstack supports 256-bit encryption for all paid plans.

Highly Scalable

The API is built upon apilayer’s cloud infrastructure, and it can meet your smallest and largest demands.

Near 100% Uptime

Did we mention weatherstack is built upon apilayer’s cloud infrastructure? Yeah, you can rely on it being available.

Extensive Documentation

The weatherstack API is thoroughly documented, providing request examples and a complete list of query parameters for all its endpoints. You’ll even find code samples to get you started.

2 Million+ WordPress Themes & Plugins, Web & Email Templates, UI Kits and More

Download thousands of WordPress themes and plugins, web templates, UI elements, and much more with an Envato Elements membership. Get unlimited access to a growing library to millions of creative and code assets.

iOS App Templates

2,500+ stunning iOS app templates for your next project.

Android App Templates

Kick-start your next Android app with 5k+ versatile templates.

App Design Templates

The perfect starting point for your next mobile app design.

How It Works

The weatherstack API is a RESTful API, and it exposes several endpoints to handle requests for the different information it provides. Responses vary based upon the requested data (real-time, historical, or forecast), but the JSON structures are well organized and documented.

Quick Tutorial

It’s simple to get started with weatherstack. You obviously need an access key, so you first need to register an account. In the API Quickstart Guide, you’ll receive your access key, a list of the available endpoints, and a few request examples to get you started.

Make API Request

Plug your access key into the URL and make a request. The API always responds with JSON (even for errors), and successful requests result in a structure containing your requested weather data. Here is a snippet from an actual response:

weatherstack API response

Of course, you’ll need to visit weatherstack’s documentation to fully integrate the API into your application, but you’ll find each endpoint thoroughly documented, along with some code samples for several popular languages. 

We should point out, however, that weatherstack’s free plan is not encrypted; HTTPS is reserved for paid plans. Attempting to use HTTPS with the free plan results in an error message (via a JSON structure) indicating that the free plan does not support HTTPS encryption.

Pricing

The weatherstack API has several subscription plans. The Free plan is great for testing and personal use, and you can make 1,000 monthly requests to the real-time endpoint.

weatherstack pricing table

Naturally, you’ll gain access to more features by choosing one of the following paid plans:

Basic: This plan includes 50,000 monthly requests, unlimited support, HTTPS encryption for all requests, and access to additional endpoints (such as location lookups, astronomy data, hour-by-hour data, and historical data).

Professional (Most Popular): In addition to the features provided by the Basic plan, this plan lets you make 300,000 requests a month and gives you access to the seven-day forecast, weather data in 40 languages, and the ability to make bulk queries.

Business: This plan gives you everything from the Professional plan but increases your request limit to 1,000,000 requests per month and the forecast data to 14 days.

Enterprise: If the business plan isn’t enough for your needs, then contact the folks at weatherstack for a custom-priced plan that is tailored to your needs.

Conclusion

Weather is an important part of everyone’s everyday life, and by integrating the weatherstack API, you can give your users real-time and historical weather data for millions of locations around the globe. Tens of thousands of companies trust weatherstack to serve accurate weather data for their applications and automations. It is rock-solid and can handle your most demanding needs.

Register for free and try it today!

Get Real-Time Weather Data With the weatherstack API



 "You can always talk about the weather." It’s a cliched phrase, but regardless of a person’s personality, political views, or culture, the weather is a subject that anyone and everyone can talk about and find common ground. It’s the universal truth that binds humanity together.

But the weather is more than that—it’s a force that affects humanity on a grand scale. Hardly a day goes by where everyone doesn’t check, or at least know about, the weather so that they can be properly prepared for a given day. And, of course, there are few things more unifying to a people within the same region than experiencing the same weather—especially during major storms that sweep across a continent.

The weather is an important part of our daily lives, and while everyone can check their favorite smartphone app or local news, there are times when individuals and businesses need a bit more. For example:

  • Imagine a smart home that automatically turns on a bathroom heater on cold mornings before you wake up and get ready for work.
  • What if a business could automatically shut off the building’s water supply and drain its pipes if the overnight forecast predicts a hard freeze?
  • Think about municipalities that could send automated alerts to their citizens with real-time, up-to-date emergency alert data.

These types of applications need reliable and up-to-date weather information, and here is where the weatherstack API comes in. By using the weatherstack API, you can power your weather-based applications with accurate real-time, historical, and forecast data.

There’s a reason why weatherstack is trusted by over 75,000 companies worldwide: they can retrieve instant, accurate weather information for any location in the world.

What Is the weatherstack API?

weatherstack API

weatherstack is a RESTful API service that allows customers to query current, historical, and forecast weather for as many worldwide locations as possible. It covers an extensive scope of weather data for almost the entire planet, and it offers cost-effective plans for companies (both big and small), developers, and individuals.

The weatherstack API is powered by the highly scalable apilayer cloud infrastructure, making it capable of handling anything from hundreds of requests a month to millions of requests a minute. It has become one of the most popular weather data REST API providers thanks to its ease of integration and consistency.

With the weatherstack API, you can:

  • add localized weather to your website (using geolocation with ipstack)
  • build weather alert systems to notify users of extreme weather in their area
  • incorporate weather data into automated processes

Features: Why Use the weatherstack API?

Microsoft, Warner Brothers, Schneider Electric (think APC), and 74,997 other companies rely on weatherstack because it provides accurate and fast results. Let’s look at why:

Accurate Real-Time Weather

The weatherstack API delivers accurate real-time weather data thanks to licensing deals with some of the largest weather stations and providers in the world.

Broad Weather Data

weatherstack covers global weather data across the board—from a multi-year history to live information to accurate forecasts.

Millions of Locations

You can use the live or hour-by-hour weather data for millions of cities and locations worldwide.

Flexible Location Lookup

You can look up locations by city or region name, ZIP code, IP address, or traditional latitude and longitude coordinates.

Speed and Lightweight Response

The weatherstack API is lightning fast, delivering weather data in a lightweight JSON format.

Bank-Level Security

weatherstack supports 256-bit encryption for all paid plans.

Highly Scalable

The API is built upon apilayer’s cloud infrastructure, and it can meet your smallest and largest demands.

Near 100% Uptime

Did we mention weatherstack is built upon apilayer’s cloud infrastructure? Yeah, you can rely on it being available.

Extensive Documentation

The weatherstack API is thoroughly documented, providing request examples and a complete list of query parameters for all its endpoints. You’ll even find code samples to get you started.

2 Million+ WordPress Themes & Plugins, Web & Email Templates, UI Kits and More

Download thousands of WordPress themes and plugins, web templates, UI elements, and much more with an Envato Elements membership. Get unlimited access to a growing library to millions of creative and code assets.

iOS App Templates

2,500+ stunning iOS app templates for your next project.

Android App Templates

Kick-start your next Android app with 5k+ versatile templates.

App Design Templates

The perfect starting point for your next mobile app design.

How It Works

The weatherstack API is a RESTful API, and it exposes several endpoints to handle requests for the different information it provides. Responses vary based upon the requested data (real-time, historical, or forecast), but the JSON structures are well organized and documented.

Quick Tutorial

It’s simple to get started with weatherstack. You obviously need an access key, so you first need to register an account. In the API Quickstart Guide, you’ll receive your access key, a list of the available endpoints, and a few request examples to get you started.

Make API Request

Plug your access key into the URL and make a request. The API always responds with JSON (even for errors), and successful requests result in a structure containing your requested weather data. Here is a snippet from an actual response:

weatherstack API response

Of course, you’ll need to visit weatherstack’s documentation to fully integrate the API into your application, but you’ll find each endpoint thoroughly documented, along with some code samples for several popular languages. 

We should point out, however, that weatherstack’s free plan is not encrypted; HTTPS is reserved for paid plans. Attempting to use HTTPS with the free plan results in an error message (via a JSON structure) indicating that the free plan does not support HTTPS encryption.

Pricing

The weatherstack API has several subscription plans. The Free plan is great for testing and personal use, and you can make 1,000 monthly requests to the real-time endpoint.

weatherstack pricing table

Naturally, you’ll gain access to more features by choosing one of the following paid plans:

Basic: This plan includes 50,000 monthly requests, unlimited support, HTTPS encryption for all requests, and access to additional endpoints (such as location lookups, astronomy data, hour-by-hour data, and historical data).

Professional (Most Popular): In addition to the features provided by the Basic plan, this plan lets you make 300,000 requests a month and gives you access to the seven-day forecast, weather data in 40 languages, and the ability to make bulk queries.

Business: This plan gives you everything from the Professional plan but increases your request limit to 1,000,000 requests per month and the forecast data to 14 days.

Enterprise: If the business plan isn’t enough for your needs, then contact the folks at weatherstack for a custom-priced plan that is tailored to your needs.

Conclusion

Weather is an important part of everyone’s everyday life, and by integrating the weatherstack API, you can give your users real-time and historical weather data for millions of locations around the globe. Tens of thousands of companies trust weatherstack to serve accurate weather data for their applications and automations. It is rock-solid and can handle your most demanding needs.

Register for free and try it today!



 Aviation is among the most important global industries because it connects people and businesses across cities, countries, and continents. It is the only rapid transportation network that spans the world. However, aviation isn’t just about transporting people; today’s economy almost completely depends upon the timely delivery of goods and services. Major retailers rely upon the aviation industry to quickly move products to their customers.

Aviation is at the heart of today’s business and lifestyle, and whether you’re building booking platforms, visualizing and monitoring global flights, or creating popular flight tracking applications, apilayer’s aviationstack API can help you deliver usable and meaningful experiences to your clients by providing real-time flight tracking, flight schedules and routes, and historical flight data.

What Is the aviationstack API?

aviationstack API

Simply put, aviationstack is an easy-to-use and cost-effective RESTful API that provides aviation-oriented data. It delivers not only real-time flight status, but also schedules, airline routes, airports, aircraft, and even historical flight data. 

aviationstack is built upon the powerful, auto-scaling apilayer cloud infrastructure. It can therefore handle as few or as many requests your application needs—from a few requests per day to millions of requests an hour!

Thanks to real-time data integration with one of the most sophisticated aviation data vendors on the market, aviationstack delivers accurate flight data that you can use to build booking and tracking applications. The aviationstack API makes it easy to:

  • track flights based on any number of criteria
  • search for specific types of aircraft
  • retrieve information about cities and airports—their time zones, geolocation, and IATA codes
  • and much more! 

Features: Why Use the aviationstack API?

Thousands of companies use aviationstack to power their booking platforms, map visualizations, and flight tracking applications because aviationstack's feature set is unparalleled. Here are just a few features:

Accurate Real-Time Tracking

aviationstack is tightly integrated with one of the most sophisticated aviation data vendors on the market. Therefore, real-time flight data is delayed by as little as 30–60 seconds.

Lookup Airline Routes and Schedules

The aviationstack API can provide data about airline routes based upon the airline, flight number, and arrival/departure airports.

Worldwide Coverage

aviationstack delivers accurate details of most global flights, regardless of what stage the flight is currently in.

Airports, Airplanes, and Airlines Oh My

You can retrieve relevant information about thousands of airplanes, airlines, airports, terminals, gates, and more from across the globe. 

Historical Flight Data

aviationstack delivers granular historical flight data (flight numbers, dates, times, airports, terminals, gates, etc.) because they’ve been storing that information since day one.

JSON Format

aviationstack always responds with structured data that can be easily parsed and analyzed.

Security

The aviationstack API supports 256-bit encryption for all paid tiers so that you don’t have to worry about your requests being transmitted in the clear.

Scalable

Like all of apilayer’s services, aviationstack is highly scalable and can meet your smallest and largest demands.

99.9% Uptime

Uptime is important, and thanks to being built on apilayer's cloud infrastructure, aviationstack’s 99.9% uptime ensures that it is highly available for your needs.

Fantastic Documentation

The API is well documented, providing all the information you need in order to issue your requests and handle the resulting responses. They even provide code samples to get you started!

2 Million+ WordPress Themes & Plugins, Web & Email Templates, UI Kits and More

Download thousands of WordPress themes and plugins, web templates, UI elements, and much more with an Envato Elements membership. Get unlimited access to a growing library to millions of creative and code assets.

iOS App Templates

2,500+ stunning iOS app templates for your next project.

Android App Templates

Kick-start your next Android app with 5k+ versatile templates.

App Design Templates

The perfect starting point for your next mobile app design.

How It Works

The aviationstack API is built on RESTful principles, and it exposes several endpoints to handle requests for different information (e.g. flights and airports). API requests are sent with a valid access key and any number of required or optional query parameters. Responses vary based upon the requested data, but the JSON structures are well organized and documented.

Quick Tutorial

Getting started with aviationstack is simple and straightforward. First, you need to register an account. You will then be taken to the API Quickstart Guide. 

API Quickstart Guide

Here you receive your access key for authentication, a list of the available endpoints, and a few request examples to get you started.

Make API Request

Simply plug in your access key and make a request. The API always responds with JSON, but if it is successful, you will receive a structure containing your requested flight data. Here is a portion of an actual response:

JSON response from aviationstack

Naturally, you’ll need to consult aviationstack’s excellent documentation for your specific integration needs and requirements. You’ll also find a variety of code samples for several languages, demonstrating how to access, query, and handle the API’s responses.

It’s important to note that aviationstack’s free plan is not encrypted, so you must therefore use plain ol' HTTP for free requests. If you attempt to use HTTPS with the free plan, the API responds with a JSON structure indicating that the free plan does not support HTTPS encryption.

Pricing

The aviationstack API has several subscription plans, including a Free plan that you can use for testing and personal use. It provides basic functionality and a limit of 500 requests per month.

aviationstack pricing table

You can gain access to more features and data endpoints by choosing from the following subscription plans:

Basic: This plan includes 10,000 monthly requests, unlimited support, HTTPS encryption for all requests, and access to additional endpoints (such as historical data, airline routes, and autocomplete).

Professional (Bestseller): In addition to the features provided by the Basic plan, you’ll gain access to extended limits and 50,000 monthly requests.

Business: This plan gives you everything from the Professional plan but increases your request limit to 250,000 requests per month.

Enterprise: Still need more? This plan gives you custom pricing tailored to your needs.

Conclusion

The aviationstack API was built to provide accurate real-time and historical flight data for flights around the globe. Thousands of companies around the world trust aviationstack to serve data for their flight booking platforms, visualization programs, flight monitoring applications, and other services in the aviation space. It’s built upon a rock-solid cloud infrastructure, allowing it to handle billions of requests with near 100% uptime.

Register for a free API and try it today!

Real-Time Global Aviation Data With the aviationstack API



 Aviation is among the most important global industries because it connects people and businesses across cities, countries, and continents. It is the only rapid transportation network that spans the world. However, aviation isn’t just about transporting people; today’s economy almost completely depends upon the timely delivery of goods and services. Major retailers rely upon the aviation industry to quickly move products to their customers.

Aviation is at the heart of today’s business and lifestyle, and whether you’re building booking platforms, visualizing and monitoring global flights, or creating popular flight tracking applications, apilayer’s aviationstack API can help you deliver usable and meaningful experiences to your clients by providing real-time flight tracking, flight schedules and routes, and historical flight data.

What Is the aviationstack API?

aviationstack API

Simply put, aviationstack is an easy-to-use and cost-effective RESTful API that provides aviation-oriented data. It delivers not only real-time flight status, but also schedules, airline routes, airports, aircraft, and even historical flight data. 

aviationstack is built upon the powerful, auto-scaling apilayer cloud infrastructure. It can therefore handle as few or as many requests your application needs—from a few requests per day to millions of requests an hour!

Thanks to real-time data integration with one of the most sophisticated aviation data vendors on the market, aviationstack delivers accurate flight data that you can use to build booking and tracking applications. The aviationstack API makes it easy to:

  • track flights based on any number of criteria
  • search for specific types of aircraft
  • retrieve information about cities and airports—their time zones, geolocation, and IATA codes
  • and much more! 

Features: Why Use the aviationstack API?

Thousands of companies use aviationstack to power their booking platforms, map visualizations, and flight tracking applications because aviationstack's feature set is unparalleled. Here are just a few features:

Accurate Real-Time Tracking

aviationstack is tightly integrated with one of the most sophisticated aviation data vendors on the market. Therefore, real-time flight data is delayed by as little as 30–60 seconds.

Lookup Airline Routes and Schedules

The aviationstack API can provide data about airline routes based upon the airline, flight number, and arrival/departure airports.

Worldwide Coverage

aviationstack delivers accurate details of most global flights, regardless of what stage the flight is currently in.

Airports, Airplanes, and Airlines Oh My

You can retrieve relevant information about thousands of airplanes, airlines, airports, terminals, gates, and more from across the globe. 

Historical Flight Data

aviationstack delivers granular historical flight data (flight numbers, dates, times, airports, terminals, gates, etc.) because they’ve been storing that information since day one.

JSON Format

aviationstack always responds with structured data that can be easily parsed and analyzed.

Security

The aviationstack API supports 256-bit encryption for all paid tiers so that you don’t have to worry about your requests being transmitted in the clear.

Scalable

Like all of apilayer’s services, aviationstack is highly scalable and can meet your smallest and largest demands.

99.9% Uptime

Uptime is important, and thanks to being built on apilayer's cloud infrastructure, aviationstack’s 99.9% uptime ensures that it is highly available for your needs.

Fantastic Documentation

The API is well documented, providing all the information you need in order to issue your requests and handle the resulting responses. They even provide code samples to get you started!

2 Million+ WordPress Themes & Plugins, Web & Email Templates, UI Kits and More

Download thousands of WordPress themes and plugins, web templates, UI elements, and much more with an Envato Elements membership. Get unlimited access to a growing library to millions of creative and code assets.

iOS App Templates

2,500+ stunning iOS app templates for your next project.

Android App Templates

Kick-start your next Android app with 5k+ versatile templates.

App Design Templates

The perfect starting point for your next mobile app design.

How It Works

The aviationstack API is built on RESTful principles, and it exposes several endpoints to handle requests for different information (e.g. flights and airports). API requests are sent with a valid access key and any number of required or optional query parameters. Responses vary based upon the requested data, but the JSON structures are well organized and documented.

Quick Tutorial

Getting started with aviationstack is simple and straightforward. First, you need to register an account. You will then be taken to the API Quickstart Guide. 

API Quickstart Guide

Here you receive your access key for authentication, a list of the available endpoints, and a few request examples to get you started.

Make API Request

Simply plug in your access key and make a request. The API always responds with JSON, but if it is successful, you will receive a structure containing your requested flight data. Here is a portion of an actual response:

JSON response from aviationstack

Naturally, you’ll need to consult aviationstack’s excellent documentation for your specific integration needs and requirements. You’ll also find a variety of code samples for several languages, demonstrating how to access, query, and handle the API’s responses.

It’s important to note that aviationstack’s free plan is not encrypted, so you must therefore use plain ol' HTTP for free requests. If you attempt to use HTTPS with the free plan, the API responds with a JSON structure indicating that the free plan does not support HTTPS encryption.

Pricing

The aviationstack API has several subscription plans, including a Free plan that you can use for testing and personal use. It provides basic functionality and a limit of 500 requests per month.

aviationstack pricing table

You can gain access to more features and data endpoints by choosing from the following subscription plans:

Basic: This plan includes 10,000 monthly requests, unlimited support, HTTPS encryption for all requests, and access to additional endpoints (such as historical data, airline routes, and autocomplete).

Professional (Bestseller): In addition to the features provided by the Basic plan, you’ll gain access to extended limits and 50,000 monthly requests.

Business: This plan gives you everything from the Professional plan but increases your request limit to 250,000 requests per month.

Enterprise: Still need more? This plan gives you custom pricing tailored to your needs.

Conclusion

The aviationstack API was built to provide accurate real-time and historical flight data for flights around the globe. Thousands of companies around the world trust aviationstack to serve data for their flight booking platforms, visualization programs, flight monitoring applications, and other services in the aviation space. It’s built upon a rock-solid cloud infrastructure, allowing it to handle billions of requests with near 100% uptime.

Register for a free API and try it today!

 

Is it time to say goodbye to your WordPress website?

Maybe it’s time for a fresh start, or perhaps you want to distance yourself from the kind of content you used to create—whatever your reasons, you probably won’t want your abandoned website hanging around on the Internet forever.

In this article, I’ll show you how to permanently delete your WordPress website, regardless of whether you created your site via WordPress.com or WordPress.org. And, if you got carried away and created multiple WordPress.com websites, then I’ll also show you how to delete all of these sites simultaneously, by cancelling your WordPress account.

WordPress.com vs. WordPress.org: What’s the Difference?

The process for deleting your website will differ depending on whether it’s a WordPress.com or a WordPress.org site, so let’s start by clarifying the differences between the two:

  • WordPress.org, sometimes referred to as self-hosted WordPress, is where you download the free WordPress software and install it on your own server. With a WordPress.org website, you’re solely responsible for hosting and maintenance. 
  • WordPress.com takes care of the hosting for you. Rather than downloading and installing the WordPress software, simply head over to WordPress.com, click Get started, complete a few forms, and WordPress.com will create your website for you.  

The Internet Is Forever

In this article, I’ll show you how to delete your website, so it no longer appears at its URL or appears in Google search results. However, if your website has been archived by third parties then there’s a chance your content will still be accessible via these third-party services. 

Deleting your website will make it less accessible, but there’s no guarantee that a determined third party won’t be able to recover some or all of your deleted content. 

How Do I Close My WordPress.com Account?

Are you performing some admin and want to delete all the accounts that you no longer use? Or perhaps you want to delete your existing WordPress account, so you can re-register and start again from scratch? 

When you close your account, WordPress will also delete all the websites associated with that account. If you got carried away and created multiple different websites, then cancelling your account may be easier than deleting each website individually.  

To close your WordPress.com account:

  • Log in to your account, if you haven’t already.
  • Head over to the Account Settings screen.
  • Scroll to the bottom of the screen and select Close your account permanently.
Cancel your WordPress account by navigating to Account Settings and selecting Close your account permanently
  • Review the list of content you’re about to delete, and if you’re happy to proceed then click Close account.
Review the items that will be deleted and if youre happy to proceed click Close account

WordPress will now delete your username, all the sites you own, and all of your content. 

Deleting a WordPress.com Blog From the Dashboard

If you created your website via WordPress.com, then you can delete it directly from the WordPress Dashboard. Note that when you delete your WordPress.com website, you’ll also lose access to your site’s URL unless you purchased the domain. 

To delete your WordPress.com site, first log in to your WordPress account, if you haven’t already.

In the left-hand menu, select Manage > Settings. Now scroll to the very bottom of the screen and select Delete your site permanently.

At this point, you’ll have the option to export all of your posts, pages, and settings as a ZIP file. If you ever change your mind and want to reinstate your website, then you can upload this ZIP file to a new WordPress site and recover your content. This step is optional, but it’s also a one-time offer: if you don’t export now, then your content will be lost forever. If you do want to hang on to a copy of your content, then click Export all. Once the export is complete, click Back to resume deleting your website.

Review all the information about the content you’re about to delete, and if you’re happy to proceed, then click Delete site. When prompted, enter your website’s full URL for a final confirmation. 

This is it! If you’re still determined to permanently remove your website from the World Wide Web, then click the Delete this site button and your WordPress website will be gone forever.  

How to Delete Your Self-Hosted Website With cPanel

If you used cPanel to set up your self-hosted WordPress website, then you can also use cPanel to delete it:  

  • Log in to your cPanel Dashboard.
  • Select the Hosting tab. 
  • Find the website that you want to delete and click its accompanying Switch button.
  • On the subsequent screen, select WordPress
  • Select Uninstall. After a few moments, you should see the following message: Software has been uninstalled.

Your WordPress website has now been deleted.

Delete Your Self-Hosted WordPress Website Manually 

If you installed the WordPress software on your server manually, then you’ll also need to remove it manually. This process can vary depending on whether you have FTP or SFTP access, or you access your web server via a web-based file manager:

1. I have FTP or SFTP Access

If you have FTP or SFTP access, then you can delete your WordPress website using an FTP client:

  • Log in to your FTP server. 
  • Locate your WordPress directory, and either Control-click or right-click it, depending on whether you’re running Windows or macOS. 
  • When prompted, select Delete.

2. I Use a Web-Based File Manager

If you have access to a web-based file manager, then:

  • Log in to your web hosting dashboard.
  • Open your file manager application.
  • Navigate to the WordPress directory that you want to delete, and hit the Delete button. 

Delete Your Website’s Database Using MySQL

After deleting your WordPress website, you may also want to delete your website’s MySQL database. You can remove this database using the following MySQL command: 

1
2
$ mysql -h HOST -u USERNAME -p PASSWORD -D wordpress
$ DROP wordpress

Note that you'll need to replace wordpress with the name of your WordPress database, which is located in your wp-config.php file. The process for locating this database will vary depending upon your hosting provider—for example, if you were using cPanel, then you would typically use the file manager to browse to your WordPress directory, which contains the wp-config.php file.

Delete Your Database Using cPanel

If you’re a cPanel user, then:

  • Log in to your cPanel Dashboard.
  • Scroll to the Databases section, and select MySQL Databases.
  • Select the MySQL database that you want to delete.
  • Find the Delete Database link, and give it a click. 
  • Read the onscreen warning, and if you’re happy to proceed, then click Delete Database.

cPanel will now delete your website’s database. 

Conclusion 

In this quick tip, I showed you how to permanently delete your WordPress.com or WordPress.org website, and how to optionally delete your site’s MySQL database. 

Are you deleting an outdated WordPress website with the intention of starting again from scratch? If you’re creating a brand new WordPress website, then be sure to check out some of our other WordPress tutorials, as they contain all the information you need to create a modern, professional, and engaging WordPress website. 

How to Delete Your WordPress Account or Blog

 

Is it time to say goodbye to your WordPress website?

Maybe it’s time for a fresh start, or perhaps you want to distance yourself from the kind of content you used to create—whatever your reasons, you probably won’t want your abandoned website hanging around on the Internet forever.

In this article, I’ll show you how to permanently delete your WordPress website, regardless of whether you created your site via WordPress.com or WordPress.org. And, if you got carried away and created multiple WordPress.com websites, then I’ll also show you how to delete all of these sites simultaneously, by cancelling your WordPress account.

WordPress.com vs. WordPress.org: What’s the Difference?

The process for deleting your website will differ depending on whether it’s a WordPress.com or a WordPress.org site, so let’s start by clarifying the differences between the two:

  • WordPress.org, sometimes referred to as self-hosted WordPress, is where you download the free WordPress software and install it on your own server. With a WordPress.org website, you’re solely responsible for hosting and maintenance. 
  • WordPress.com takes care of the hosting for you. Rather than downloading and installing the WordPress software, simply head over to WordPress.com, click Get started, complete a few forms, and WordPress.com will create your website for you.  

The Internet Is Forever

In this article, I’ll show you how to delete your website, so it no longer appears at its URL or appears in Google search results. However, if your website has been archived by third parties then there’s a chance your content will still be accessible via these third-party services. 

Deleting your website will make it less accessible, but there’s no guarantee that a determined third party won’t be able to recover some or all of your deleted content. 

How Do I Close My WordPress.com Account?

Are you performing some admin and want to delete all the accounts that you no longer use? Or perhaps you want to delete your existing WordPress account, so you can re-register and start again from scratch? 

When you close your account, WordPress will also delete all the websites associated with that account. If you got carried away and created multiple different websites, then cancelling your account may be easier than deleting each website individually.  

To close your WordPress.com account:

  • Log in to your account, if you haven’t already.
  • Head over to the Account Settings screen.
  • Scroll to the bottom of the screen and select Close your account permanently.
Cancel your WordPress account by navigating to Account Settings and selecting Close your account permanently
  • Review the list of content you’re about to delete, and if you’re happy to proceed then click Close account.
Review the items that will be deleted and if youre happy to proceed click Close account

WordPress will now delete your username, all the sites you own, and all of your content. 

Deleting a WordPress.com Blog From the Dashboard

If you created your website via WordPress.com, then you can delete it directly from the WordPress Dashboard. Note that when you delete your WordPress.com website, you’ll also lose access to your site’s URL unless you purchased the domain. 

To delete your WordPress.com site, first log in to your WordPress account, if you haven’t already.

In the left-hand menu, select Manage > Settings. Now scroll to the very bottom of the screen and select Delete your site permanently.

At this point, you’ll have the option to export all of your posts, pages, and settings as a ZIP file. If you ever change your mind and want to reinstate your website, then you can upload this ZIP file to a new WordPress site and recover your content. This step is optional, but it’s also a one-time offer: if you don’t export now, then your content will be lost forever. If you do want to hang on to a copy of your content, then click Export all. Once the export is complete, click Back to resume deleting your website.

Review all the information about the content you’re about to delete, and if you’re happy to proceed, then click Delete site. When prompted, enter your website’s full URL for a final confirmation. 

This is it! If you’re still determined to permanently remove your website from the World Wide Web, then click the Delete this site button and your WordPress website will be gone forever.  

How to Delete Your Self-Hosted Website With cPanel

If you used cPanel to set up your self-hosted WordPress website, then you can also use cPanel to delete it:  

  • Log in to your cPanel Dashboard.
  • Select the Hosting tab. 
  • Find the website that you want to delete and click its accompanying Switch button.
  • On the subsequent screen, select WordPress
  • Select Uninstall. After a few moments, you should see the following message: Software has been uninstalled.

Your WordPress website has now been deleted.

Delete Your Self-Hosted WordPress Website Manually 

If you installed the WordPress software on your server manually, then you’ll also need to remove it manually. This process can vary depending on whether you have FTP or SFTP access, or you access your web server via a web-based file manager:

1. I have FTP or SFTP Access

If you have FTP or SFTP access, then you can delete your WordPress website using an FTP client:

  • Log in to your FTP server. 
  • Locate your WordPress directory, and either Control-click or right-click it, depending on whether you’re running Windows or macOS. 
  • When prompted, select Delete.

2. I Use a Web-Based File Manager

If you have access to a web-based file manager, then:

  • Log in to your web hosting dashboard.
  • Open your file manager application.
  • Navigate to the WordPress directory that you want to delete, and hit the Delete button. 

Delete Your Website’s Database Using MySQL

After deleting your WordPress website, you may also want to delete your website’s MySQL database. You can remove this database using the following MySQL command: 

1
2
$ mysql -h HOST -u USERNAME -p PASSWORD -D wordpress
$ DROP wordpress

Note that you'll need to replace wordpress with the name of your WordPress database, which is located in your wp-config.php file. The process for locating this database will vary depending upon your hosting provider—for example, if you were using cPanel, then you would typically use the file manager to browse to your WordPress directory, which contains the wp-config.php file.

Delete Your Database Using cPanel

If you’re a cPanel user, then:

  • Log in to your cPanel Dashboard.
  • Scroll to the Databases section, and select MySQL Databases.
  • Select the MySQL database that you want to delete.
  • Find the Delete Database link, and give it a click. 
  • Read the onscreen warning, and if you’re happy to proceed, then click Delete Database.

cPanel will now delete your website’s database. 

Conclusion 

In this quick tip, I showed you how to permanently delete your WordPress.com or WordPress.org website, and how to optionally delete your site’s MySQL database. 

Are you deleting an outdated WordPress website with the intention of starting again from scratch? If you’re creating a brand new WordPress website, then be sure to check out some of our other WordPress tutorials, as they contain all the information you need to create a modern, professional, and engaging WordPress website. 

 


Markup of Our HTML Contact Form

The first step towards creating our own contact form is to code the markup. We will start doing that once we have a list of all the elements that we want inside our form. We'll need an input field for the name of the person who is contacting us, and we'll need a field for their email address so that we can reply to them if the need arises. We'll also need an input field for the reason people are contacting you and a textarea where users can type their message.

If the website you are managing is very popular, you'll be getting a lot of emails through the contact form. To make sure that the right people get to read those emails and respond quickly, you need a couple more fields. For instance, you could add a field that can determine which department the visitor wants to contact, like marketing, support, or billing. This information can later be used to route the email appropriately. Ultimately, that might help you reply more quickly and sort the emails more efficiently.

How many fields you add to the contact form depends on the type of website you run, but make sure you don't overdo it. Forcing visitors to fill out too many details might discourage them from contacting you altogether.

Let's write the HTML code to add all the fields I just mentioned into our contact form.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<form action="contact.php" method="post">
  <div class="elem-group">
    <label for="name">Your Name</label>
    <input type="text" id="name" name="visitor_name" placeholder="John Doe" pattern=[A-Z\sa-z]{3,20} required>
  </div>
  <div class="elem-group">
    <label for="email">Your E-mail</label>
    <input type="email" id="email" name="visitor_email" placeholder="john.doe@email.com" required>
  </div>
  <div class="elem-group">
    <label for="department-selection">Choose Concerned Department</label>
    <select id="department-selection" name="concerned_department" required>
        <option value="">Select a Department</option>
        <option value="billing">Billing</option>
        <option value="marketing">Marketing</option>
        <option value="technical support">Technical Support</option>
    </select>
  </div>
  <div class="elem-group">
    <label for="title">Reason For Contacting Us</label>
    <input type="text" id="title" name="email_title" required placeholder="Unable to Reset my Password" pattern=[A-Za-z0-9\s]{8,60}>
  </div>
  <div class="elem-group">
    <label for="message">Write your message</label>
    <textarea id="message" name="visitor_message" placeholder="Say whatever you want." required></textarea>
  </div>
  <button type="submit">Send Message</button>
</form>

Before proceeding any further, I would like to quickly summarize the meaning of some important attributes in the above markup. The action attribute in the form determines where the form data needs to be sent. If you don't have an action attribute, the data is sent back to the same URL. Here we've used contact.php, so the form data will be sent to that script.

The name attribute for different input elements in the form is used to access the element values on the server side. For example, in the above form, you can get the name of the visitor contacting you using $_POST['visitor_name'] in contact.php.

We use the placeholder attribute to give users a basic idea of the expected input for each field in the form. The required attribute ensures that no important field is left blank before the user hits the submit button on the form. 

The pattern attribute is used to enforce some rules on the kinds of values that can go inside certain fields. In our case, we only allow users to use letters and the space character in the names they submit. We also limit the total number of acceptable characters to anything from 3 to 20 inclusive. The pattern that you use will depend on the type of input that you want from users.

The following CodePen demo shows us what our contact form looks like with the above markup and a little bit of CSS.

Making Our HTML Contact Form Functional Using PHP

Right now, our form doesn't do anything useful. Visitors can fill it out and hit the send message button, but we won't receive anything because there is no server-side code to handle the information provided by the form. In this section, we'll make our contact form functional using PHP.

Begin by creating a contact.php file and putting the following code inside it.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
  
if($_POST) {
    $visitor_name = "";
    $visitor_email = "";
    $email_title = "";
    $concerned_department = "";
    $visitor_message = "";
    $email_body = "<div>";
      
    if(isset($_POST['visitor_name'])) {
        $visitor_name = filter_var($_POST['visitor_name'], FILTER_SANITIZE_STRING);
        $email_body .= "<div>
                           <label><b>Visitor Name:</b></label>&nbsp;<span>".$visitor_name."</span>
                        </div>";
    }
 
    if(isset($_POST['visitor_email'])) {
        $visitor_email = str_replace(array("\r", "\n", "%0a", "%0d"), '', $_POST['visitor_email']);
        $visitor_email = filter_var($visitor_email, FILTER_VALIDATE_EMAIL);
        $email_body .= "<div>
                           <label><b>Visitor Email:</b></label>&nbsp;<span>".$visitor_email."</span>
                        </div>";
    }
      
    if(isset($_POST['email_title'])) {
        $email_title = filter_var($_POST['email_title'], FILTER_SANITIZE_STRING);
        $email_body .= "<div>
                           <label><b>Reason For Contacting Us:</b></label>&nbsp;<span>".$email_title."</span>
                        </div>";
    }
      
    if(isset($_POST['concerned_department'])) {
        $concerned_department = filter_var($_POST['concerned_department'], FILTER_SANITIZE_STRING);
        $email_body .= "<div>
                           <label><b>Concerned Department:</b></label>&nbsp;<span>".$concerned_department."</span>
                        </div>";
    }
      
    if(isset($_POST['visitor_message'])) {
        $visitor_message = htmlspecialchars($_POST['visitor_message']);
        $email_body .= "<div>
                           <label><b>Visitor Message:</b></label>
                           <div>".$visitor_message."</div>
                        </div>";
    }
      
    if($concerned_department == "billing") {
        $recipient = "billing@domain.com";
    }
    else if($concerned_department == "marketing") {
        $recipient = "marketing@domain.com";
    }
    else if($concerned_department == "technical support") {
        $recipient = "tech.support@domain.com";
    }
    else {
        $recipient = "contact@domain.com";
    }
      
    $email_body .= "</div>";
 
    $headers  = 'MIME-Version: 1.0' . "\r\n"
    .'Content-type: text/html; charset=utf-8' . "\r\n"
    .'From: ' . $visitor_email . "\r\n";
      
    if(mail($recipient, $email_title, $email_body, $headers)) {
        echo "<p>Thank you for contacting us, $visitor_name. You will get a reply within 24 hours.</p>";
    } else {
        echo '<p>We are sorry but the email did not go through.</p>';
    }
      
} else {
    echo '<p>Something went wrong</p>';
}
?>

We have already done some client-side validation of user input. However, it's always safer to do server-side validation as well. We use the filter_var() function to sanitize the name provided by the user. In a similar fashion, we also sanitize the value of $email_title and $concerned_department. You can use the filter_var()function to validate or sanitize all types of user input. We also use the htmlspecialchars() function to encode all the special HTML characters in the visitor message sent to us.

The value of $recipient is based on the value of the variable $concerned_department. This way, we make sure that only people who are actually supposed to look into the matter receive the email.

Also, we've used the $email_body variable to format the email body which will be the main content of the email. As we are sending an email in the HTML format, we've used HTML to format the email body content.

Finally, we use the mail() function to send an email which includes the information the visitor wanted us to know. Upon successful delivery of the email, we let the visitors know that we have received their email and that they will be contacted soon.

Security is paramount when you are dealing with user data or input. Whether you should validate or sanitize the user input depends on what the input is and how you want to use it.

Validation simply checks if the user input follows a certain set of rules. For example, validation could check that the name of a person does not contain any numbers.

Sanitization is used to remove any offending characters that pose a security risk. For example, a malicious user trying to contact you through the form might add a script tag in the textarea to get you to download a harmful script. This is particularly worrisome when your website has public forums accessible by everyone.

However, you have to be very careful when getting rid of unwanted characters in user input. For example, you might decide to use filter_var($user_input, FILTER_SANITIZE_STRING); on some input to strip all tags and encode special characters. However, this flag also strips harmless character input by legitimate users. Here is an example:

01
02
03
04
05
06
07
08
09
10
11
<?php
  
$string = 'One of your posts about inequalities mentioned that when x < y and y < z then x < z.';
  
// Output: One of your posts about inequalities mentioned that when x
echo filter_var($string, FILTER_SANITIZE_STRING);
  
// Output: One of your posts about inequalities mentioned that when x &lt; y and y &lt; z then x &lt; z.
echo htmlspecialchars($string);
  
?>

If your website has a lot of maths-related topics, it will be relatively common for users to write < or > in contact forms or forum posts. Using the FILTER_SANITIZE_STRING flag with the filter_var() function will strip necessary information from the message in this case.

The point I am trying to make is that even though you should always validate or sanitize user data, make sure that you are not stripping away crucial information in the process.

Create a Contact Form in PHP

 


Markup of Our HTML Contact Form

The first step towards creating our own contact form is to code the markup. We will start doing that once we have a list of all the elements that we want inside our form. We'll need an input field for the name of the person who is contacting us, and we'll need a field for their email address so that we can reply to them if the need arises. We'll also need an input field for the reason people are contacting you and a textarea where users can type their message.

If the website you are managing is very popular, you'll be getting a lot of emails through the contact form. To make sure that the right people get to read those emails and respond quickly, you need a couple more fields. For instance, you could add a field that can determine which department the visitor wants to contact, like marketing, support, or billing. This information can later be used to route the email appropriately. Ultimately, that might help you reply more quickly and sort the emails more efficiently.

How many fields you add to the contact form depends on the type of website you run, but make sure you don't overdo it. Forcing visitors to fill out too many details might discourage them from contacting you altogether.

Let's write the HTML code to add all the fields I just mentioned into our contact form.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<form action="contact.php" method="post">
  <div class="elem-group">
    <label for="name">Your Name</label>
    <input type="text" id="name" name="visitor_name" placeholder="John Doe" pattern=[A-Z\sa-z]{3,20} required>
  </div>
  <div class="elem-group">
    <label for="email">Your E-mail</label>
    <input type="email" id="email" name="visitor_email" placeholder="john.doe@email.com" required>
  </div>
  <div class="elem-group">
    <label for="department-selection">Choose Concerned Department</label>
    <select id="department-selection" name="concerned_department" required>
        <option value="">Select a Department</option>
        <option value="billing">Billing</option>
        <option value="marketing">Marketing</option>
        <option value="technical support">Technical Support</option>
    </select>
  </div>
  <div class="elem-group">
    <label for="title">Reason For Contacting Us</label>
    <input type="text" id="title" name="email_title" required placeholder="Unable to Reset my Password" pattern=[A-Za-z0-9\s]{8,60}>
  </div>
  <div class="elem-group">
    <label for="message">Write your message</label>
    <textarea id="message" name="visitor_message" placeholder="Say whatever you want." required></textarea>
  </div>
  <button type="submit">Send Message</button>
</form>

Before proceeding any further, I would like to quickly summarize the meaning of some important attributes in the above markup. The action attribute in the form determines where the form data needs to be sent. If you don't have an action attribute, the data is sent back to the same URL. Here we've used contact.php, so the form data will be sent to that script.

The name attribute for different input elements in the form is used to access the element values on the server side. For example, in the above form, you can get the name of the visitor contacting you using $_POST['visitor_name'] in contact.php.

We use the placeholder attribute to give users a basic idea of the expected input for each field in the form. The required attribute ensures that no important field is left blank before the user hits the submit button on the form. 

The pattern attribute is used to enforce some rules on the kinds of values that can go inside certain fields. In our case, we only allow users to use letters and the space character in the names they submit. We also limit the total number of acceptable characters to anything from 3 to 20 inclusive. The pattern that you use will depend on the type of input that you want from users.

The following CodePen demo shows us what our contact form looks like with the above markup and a little bit of CSS.

Making Our HTML Contact Form Functional Using PHP

Right now, our form doesn't do anything useful. Visitors can fill it out and hit the send message button, but we won't receive anything because there is no server-side code to handle the information provided by the form. In this section, we'll make our contact form functional using PHP.

Begin by creating a contact.php file and putting the following code inside it.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
  
if($_POST) {
    $visitor_name = "";
    $visitor_email = "";
    $email_title = "";
    $concerned_department = "";
    $visitor_message = "";
    $email_body = "<div>";
      
    if(isset($_POST['visitor_name'])) {
        $visitor_name = filter_var($_POST['visitor_name'], FILTER_SANITIZE_STRING);
        $email_body .= "<div>
                           <label><b>Visitor Name:</b></label>&nbsp;<span>".$visitor_name."</span>
                        </div>";
    }
 
    if(isset($_POST['visitor_email'])) {
        $visitor_email = str_replace(array("\r", "\n", "%0a", "%0d"), '', $_POST['visitor_email']);
        $visitor_email = filter_var($visitor_email, FILTER_VALIDATE_EMAIL);
        $email_body .= "<div>
                           <label><b>Visitor Email:</b></label>&nbsp;<span>".$visitor_email."</span>
                        </div>";
    }
      
    if(isset($_POST['email_title'])) {
        $email_title = filter_var($_POST['email_title'], FILTER_SANITIZE_STRING);
        $email_body .= "<div>
                           <label><b>Reason For Contacting Us:</b></label>&nbsp;<span>".$email_title."</span>
                        </div>";
    }
      
    if(isset($_POST['concerned_department'])) {
        $concerned_department = filter_var($_POST['concerned_department'], FILTER_SANITIZE_STRING);
        $email_body .= "<div>
                           <label><b>Concerned Department:</b></label>&nbsp;<span>".$concerned_department."</span>
                        </div>";
    }
      
    if(isset($_POST['visitor_message'])) {
        $visitor_message = htmlspecialchars($_POST['visitor_message']);
        $email_body .= "<div>
                           <label><b>Visitor Message:</b></label>
                           <div>".$visitor_message."</div>
                        </div>";
    }
      
    if($concerned_department == "billing") {
        $recipient = "billing@domain.com";
    }
    else if($concerned_department == "marketing") {
        $recipient = "marketing@domain.com";
    }
    else if($concerned_department == "technical support") {
        $recipient = "tech.support@domain.com";
    }
    else {
        $recipient = "contact@domain.com";
    }
      
    $email_body .= "</div>";
 
    $headers  = 'MIME-Version: 1.0' . "\r\n"
    .'Content-type: text/html; charset=utf-8' . "\r\n"
    .'From: ' . $visitor_email . "\r\n";
      
    if(mail($recipient, $email_title, $email_body, $headers)) {
        echo "<p>Thank you for contacting us, $visitor_name. You will get a reply within 24 hours.</p>";
    } else {
        echo '<p>We are sorry but the email did not go through.</p>';
    }
      
} else {
    echo '<p>Something went wrong</p>';
}
?>

We have already done some client-side validation of user input. However, it's always safer to do server-side validation as well. We use the filter_var() function to sanitize the name provided by the user. In a similar fashion, we also sanitize the value of $email_title and $concerned_department. You can use the filter_var()function to validate or sanitize all types of user input. We also use the htmlspecialchars() function to encode all the special HTML characters in the visitor message sent to us.

The value of $recipient is based on the value of the variable $concerned_department. This way, we make sure that only people who are actually supposed to look into the matter receive the email.

Also, we've used the $email_body variable to format the email body which will be the main content of the email. As we are sending an email in the HTML format, we've used HTML to format the email body content.

Finally, we use the mail() function to send an email which includes the information the visitor wanted us to know. Upon successful delivery of the email, we let the visitors know that we have received their email and that they will be contacted soon.

Security is paramount when you are dealing with user data or input. Whether you should validate or sanitize the user input depends on what the input is and how you want to use it.

Validation simply checks if the user input follows a certain set of rules. For example, validation could check that the name of a person does not contain any numbers.

Sanitization is used to remove any offending characters that pose a security risk. For example, a malicious user trying to contact you through the form might add a script tag in the textarea to get you to download a harmful script. This is particularly worrisome when your website has public forums accessible by everyone.

However, you have to be very careful when getting rid of unwanted characters in user input. For example, you might decide to use filter_var($user_input, FILTER_SANITIZE_STRING); on some input to strip all tags and encode special characters. However, this flag also strips harmless character input by legitimate users. Here is an example:

01
02
03
04
05
06
07
08
09
10
11
<?php
  
$string = 'One of your posts about inequalities mentioned that when x < y and y < z then x < z.';
  
// Output: One of your posts about inequalities mentioned that when x
echo filter_var($string, FILTER_SANITIZE_STRING);
  
// Output: One of your posts about inequalities mentioned that when x &lt; y and y &lt; z then x &lt; z.
echo htmlspecialchars($string);
  
?>

If your website has a lot of maths-related topics, it will be relatively common for users to write < or > in contact forms or forum posts. Using the FILTER_SANITIZE_STRING flag with the filter_var() function will strip necessary information from the message in this case.

The point I am trying to make is that even though you should always validate or sanitize user data, make sure that you are not stripping away crucial information in the process.