Expanding URLs in PHP and MYSQL using Regex function


Hey Wassup everyone today I am going to show you how to make a system which detects the URL from the text string in PHP and check whether the Url is from Youtube, Google, Vimeo, Dailymotion as this script currently supports only these providers and if the URL matches one of them it will embed the video dynamically from the Url.

Subscribe on Youtube Download Demo

Sounds cool right?

Let’s learn how to use that function.

in the script, there is a file named function.php and this file contains the function that detect the URL and converts it into the embed link.

In this function, the Url’s detected by regex method which matches the string and detects from which provider the URL is from and then output the embed code and then using the detect(); function of function.php in the index page we can embed the video from the URL.

It’s that simple.

So I hope you guys enjoy the tutorial and learn how to embed the video from the Url easily without using Jquery or Ajax. it is just in simple and basic PHP.

So that’s it for this tutorial if you like it please subscribe to my Youtube Channel and my blog to get updated time to time via Email.