diff options
Diffstat (limited to 'Digitigrade/LinkPreview.php')
| -rw-r--r-- | Digitigrade/LinkPreview.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Digitigrade/LinkPreview.php b/Digitigrade/LinkPreview.php index 706c3c7..718a196 100644 --- a/Digitigrade/LinkPreview.php +++ b/Digitigrade/LinkPreview.php @@ -32,7 +32,8 @@ class LinkPreview implements \JsonSerializable { // TODO: Respect Content-Type header from response, maybe set an Accept header in the request? // I was able to find a URL serving SHIFT-JIS, but they do not specify a charset in the Content-Type header. // https://www2d.biglobe.ne.jp/~msyk/charcode/cp932/Windows-31J-charset.html - $c = @file_get_contents($this->url); + $max_length = 256 * 1024; // 256KiB should be enough for the document head + $c = @file_get_contents($this->url, false, null, 0, $max_length); if (!$c) return false; $d = \Dom\HTMLDocument::createFromString($c, LIBXML_NOERROR); |
