From 0f39b502e89dbde20c840ffa4886cf430e9b0a9d Mon Sep 17 00:00:00 2001 From: shibafu Date: Wed, 11 Apr 2018 01:17:52 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AA=E3=82=AB=E3=82=BA=E3=83=AA=E3=83=B3?= =?UTF-8?q?=E3=82=AF=E3=81=AE=E3=82=B5=E3=83=A0=E3=83=8D=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E5=8F=96=E5=BE=97=E3=81=AB=E3=81=A6=E3=80=81=E7=89=B9=E5=AE=9A?= =?UTF-8?q?=E3=81=AEJSON=E3=81=AE=E3=83=87=E3=82=B3=E3=83=BC=E3=83=89?= =?UTF-8?q?=E5=89=8D=E3=81=AB=E6=94=B9=E8=A1=8C=E3=82=B3=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=82=92=E3=82=A8=E3=82=B9=E3=82=B1=E3=83=BC=E3=83=97=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/api.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routes/api.php b/routes/api.php index f89d197..79ecd98 100644 --- a/routes/api.php +++ b/routes/api.php @@ -71,7 +71,8 @@ Route::get('/checkin/card', function (Request $request) { // ニジエ用の処理 $dataNode = $xpath->query('//script[substring(@type, string-length(@type) - 3, 4) = "json"]'); foreach ($dataNode as $node) { - $imageData = json_decode($node->nodeValue, true); + // 改行がそのまま入っていることがあるのでデコード前にエスケープが必要 + $imageData = json_decode(preg_replace('/\r?\n/', '\n', $node->nodeValue), true); if (isset($imageData['thumbnailUrl'])) { $result['image'] = preg_replace('~nijie\\.info/.*/nijie_picture/~', 'nijie.info/nijie_picture/', $imageData['thumbnailUrl']); break;