In Javascript you can scan a live web page and extract elements from it, just like you can in php. The main difference is with Javascript, you are mostly restricted to being able to scan web pages that reside on the same url as where the Javascript code resides due to known as Access Control Allow Origin
which is a security feature that prevents a website from crawling and fetching content from a different website. Why html standards allow this to occur with PHP code and not Javascript I am unsure of.
Here is how to take a web page url on your own website, grab the html code from that web page url, convert the html code into a document and then use Javascripts .querySelectorAll()
function to extract any html elements you wish. In this particular example we are extracting the links from the document created from the html code grabbed from a web page url.