From 08db89396d373788b305ab47efcf78e2aefc4412 Mon Sep 17 00:00:00 2001 From: hedii Date: Mon, 6 Jul 2015 10:54:19 +0200 Subject: [PATCH] Revert "Revert "fix utf8 encoding"" This reverts commit f8b56ce1acc59b62dbd7b9589af6f8b84a3d1248. --- ColissimoApi/ColissimoApi.php | 7 ++++++- index.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ColissimoApi/ColissimoApi.php b/ColissimoApi/ColissimoApi.php index 5300ce9..60fd6c1 100644 --- a/ColissimoApi/ColissimoApi.php +++ b/ColissimoApi/ColissimoApi.php @@ -81,9 +81,12 @@ private function getPage($id) private function storeTable($data) { $table = '' . $this->get_string_between($data, '
', '
') . ''; + //$table = mb_convert_encoding($table, 'UTF-8', 'OLD-ENCODING'); + $table = utf8_encode($table); + //var_dump($table); die; $unique_id = uniqid(); $filePath = 'temp/' . $unique_id . '.html'; - $file = file_put_contents('temp/' . $unique_id . '.html', $table); + $file = file_put_contents($filePath, $table); // if $file is under 600, there is something wrong, stop everything if ($file < 600) { @@ -104,6 +107,8 @@ private function storeTable($data) private function parse($filePath) { $content = file_get_contents($filePath); + //var_dump($content); + //die(); $dom = new DOMDocument(); @$html = $dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8')); $dom->preserveWhiteSpace = false; diff --git a/index.php b/index.php index 9ea8dbf..fea6dd5 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,7 @@ run(); \ No newline at end of file