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