The function in php when implemented, it will extract all links of any given url. Its on of the daunting tasks i faced when trying to extract all links from any given url, there are some a tags whose href attributes contain mailto:example@example.co, tel:000-000-02-02, javascript:callFunction() , am sure you probably don't want to get those kind of links, expecially if you have to test for availability. Fill free to copy the code in your php and test it. credit is given to https://stackoverflow.com/a/22964930/8492507 for checking external links from a url.