Skip to content

Utility class to retrieve the open graph tags from a snippet (or full page) of html.

Notifications You must be signed in to change notification settings

tammyd/OpenGraphTagParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OpenGraphTagParser

Utility class to retrieve the open graph tags from a snippet (or full page) of html.

####Note: Requires PHP 5.4+

Sample usage:

<?php
use OpenGraph\Parser;

//grab some html content however you see fit
$html = file_get_contents('http://www.cbc.ca/player/News/ID/2397337814/');

$parser = new Parser($html); //parse it

echo $parser->title; //Skydiving seniors

The only file you need to actually use this class can be found here.

For more examples in the form of unit tests, please clone the entire repo and see OpenGraph/Parser/Tests/ParserTest.php. You can run the full suite of unit tests as follows:

$ cd OpenGraphTagParser
$ phpunit

About

Utility class to retrieve the open graph tags from a snippet (or full page) of html.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages