Skip to content

Commit a3eb26f

Browse files
authored
Merge pull request #117 from aaronpk/issue-106
send `Accept: text/html` header
2 parents 71a3535 + aca6432 commit a3eb26f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Mf2/Parser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ function fetch($url, $convertClassic = true, &$curlInfo=null) {
6969
curl_setopt($ch, CURLOPT_HEADER, 0);
7070
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
7171
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
72+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
73+
'Accept: text/html'
74+
));
7275
$html = curl_exec($ch);
7376
$info = $curlInfo = curl_getinfo($ch);
7477
curl_close($ch);

bin/fetch-mf2

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ if (!file_exists($url)) {
3131
}
3232
}
3333

34-
$html = file_get_contents($url);
35-
36-
$result = Mf2\parse($html, $url);
34+
$result = Mf2\fetch($url);
3735

3836
if (defined('JSON_PRETTY_PRINT')) {
3937
echo json_encode($result, JSON_PRETTY_PRINT);

0 commit comments

Comments
 (0)