php - Parsing a Web Page's Source given URL -


By looking at the URL, how do you parse the source code of a certain web page? I was authored with source code, title and last time it was modified.

My idea is to parse the source code with file_get_contents (), then, for the author, I'll be able to & lt; Meta name = "author" content = "[...]"> and then remove what's in the content. For the title, I & lt; Title> [...] & lt; / Title> and remove what's inside. I'm not sure what I will do when finally it was modified.

Will these methods work?

You can use file_get_contents.

For example:

  $ content = file_get_contents ('http://www.external-site.com/page.php');  

Then the variable $ content will contain the contents of the external site.


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -