The code below will let you to check a valid URL in PHP. When we need to validate an input field that only accepts URL, you can use the following code: