Skip to content

Instantly share code, notes, and snippets.

@jonnybarnes
Created February 20, 2014 12:30
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/9112466 to your computer and use it in GitHub Desktop.
Save jonnybarnes/9112466 to your computer and use it in GitHub Desktop.
<?php
try {
$content = $this->getContent($source);
} catch (Exception $e) {
$response = Response::make('There was an error getting the content', 400);
return $response;
}
$mf = \Mf2\parse($content, $baseurl);
print_r($mf);
public function getContent($url)
{
$client = new Client();
$request = $client->get($url);
try {
$response = $request->send();
} catch(Guzzle\Http\Excpetion\BadResponseException $e) {
$content = 'Error getting source';
$response = Response::make($content, 400);
return $response;
}
return $response->getBody();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment