Skip to content

Instantly share code, notes, and snippets.

@jonnybarnes
Created August 15, 2014 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonnybarnes/61a2bc9e360b12d53b1f to your computer and use it in GitHub Desktop.
Save jonnybarnes/61a2bc9e360b12d53b1f to your computer and use it in GitHub Desktop.
<?php
include "../vendor/autoload.php";
$html = '<!doctype html><html><body>
<div class="h-feed">
<div class="h-entry">
<p class="e-content">Hello world</p>
</div>
</div>
</body></html>';
$mf = \Mf2\parse($html);
echo "<pre>";
print_r($mf);
Array
(
[items] => Array
(
[0] => Array
(
[type] => Array
(
[0] => h-feed
)
[properties] => Array
(
[name] => Array
(
[0] => Hello world
)
)
[children] => Array
(
[0] => Array
(
[type] => Array
(
[0] => h-entry
)
[properties] => Array
(
[content] => Array
(
[0] => Array
(
[html] => Hello world
[value] => Hello world
)
)
[name] => Array
(
[0] => Hello world
)
)
[value] => Hello world
)
)
)
)
[rels] => Array
(
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment