diff --git a/Mf2/Parser.php b/Mf2/Parser.php index 11c6302..5341d9e 100644 --- a/Mf2/Parser.php +++ b/Mf2/Parser.php @@ -69,6 +69,9 @@ function fetch($url, $convertClassic = true, &$curlInfo=null) { curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_MAXREDIRS, 5); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Accept: text/html' + )); $html = curl_exec($ch); $info = $curlInfo = curl_getinfo($ch); curl_close($ch); diff --git a/bin/fetch-mf2 b/bin/fetch-mf2 index 05a073e..2e8e578 100755 --- a/bin/fetch-mf2 +++ b/bin/fetch-mf2 @@ -31,9 +31,7 @@ if (!file_exists($url)) { } } -$html = file_get_contents($url); - -$result = Mf2\parse($html, $url); +$result = Mf2\fetch($url); if (defined('JSON_PRETTY_PRINT')) { echo json_encode($result, JSON_PRETTY_PRINT);