How to check whether the given URL is valid or not?; In this post, I will learn you how to check given given URL is a valid URL or not validate. This is very simple a PHP function will help us to check valid URLs.
Using PHP function filter_var(), This function will check and return boolean true if the URL is valid else it will return false. After Having This post you will easy to check URL using PHP function.
To check a valid URL in PHP, We need to pass two arguments in this function. In the first argument, we will pass the URL which we what to check and in the second argument need to pass type to check from the given string using this function.
How Do Check Whether The Email Address Valid Email Or Not In PHP Example
<?php $url = "https://www.webappfix.com"; //First we will Remove all illegal characters from a url $url = filter_var($url, FILTER_SANITIZE_URL); // Validate url if (!filter_var($url, FILTER_VALIDATE_URL) === false) { echo("$url is a valid URL"); // TRUE } else { echo("$url is not a valid URL"); }
We always thanks to you for reading our blogs.
Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- How to Make/Create/Write JSON File Using PHP Array In Laravel - PHP
- Firebase Dynamic Links Shorten URL PHP Function
- Call to undefined function Gregwar\Captcha\imagecreatetruecolor()
- How To Check Given URL Is Valid Or Not PHP Function Example
- How To Add Google reCAPTCHA v3 In HTML Form Based PHP/Laravel Website
- How To Get Current Request Method Post Patch Get In Laravel - PHP
- How to connect database with php
- How To Add Google reCAPTCHA v2 In HTML Form Based PHP/Laravel Website
- Zaakpay Payment gateway Integration Tutorial PHP
- How Do Check Whether The Email Address Valid Email Or Not In PHP Example