That code is already procedural. Yes, it uses the built-in DOMDocument class, and therefore you have to use object/method notation via the ->
operator, but that's the only option if you want to use DOMDocument: there are no corresponding procedural-style PHP functions for it.
All you need is to research how to use the PHP cURL functions to grab the desired HTML from a URL and put the HTML into that $document
variable, and then do whatever DOM manipulations you want. 🤷♂️