Skip to content

BertMaurau/php-url-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

url-scraper

Plain and simple, could use some more fine-tuning, better error handling, proper class structure etc.. But this was just a quick code for another project and wanted to share this.

Just a simple PHP URL scraper that will fetch:

  • Title
  • Description
  • Image
  • Meta Tags
  • OG Tags

Usage

// include the class
require_once __DIR__ . '/URLScraper.php';

// get the results
$result = URLScraper::get("https://bertmaurau.be/");  

echo json_encode($result, JSON_PRETTY_PRINT);

Will result in

{
	"url": "https:\/\/bertmaurau.be\/",
	"domain": "bertmaurau.be",
	"title": "Bert Maurau",
	"description": "Hello World!",
	"image": "https:\/\/bertmaurau.be\/assets\/img\/profile.jpg",
	"tags_meta": {
		"viewport": "width=device-width, initial-scale=1.0",
		"description": "Bert Maurau, a 25 year old, Belgium-based Back-End Web- & Mobile Developer!",
		"author": "Bert Maurau",
		"keywords": "web,design,html,css,html5,development,bert,maurau,bert maurau,portfolio,profile,website,personal,angularjs,php,mysql,ionic,javascript"
	},
	"tags_og": {
		"title": "Bert Maurau",
		"image": "https:\/\/bertmaurau.be\/assets\/img\/profile.jpg",
		"description": "Hello World!"
	}
}

About

A simple URL scaper to get the basic info (tags, title, description, ..)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages