|
@@ -63,22 +63,38 @@ class Parser extends CI_Controller
|
63
|
63
|
private function downloadProcess($urlXML)
|
64
|
64
|
{
|
65
|
65
|
$fileName = basename($urlXML);
|
66
|
|
- $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
|
|
66
|
+ $downladedZip = $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
|
|
67
|
+
|
|
68
|
+ if ($downladedZip) {
|
|
69
|
+ $zip = new ZipArchive;
|
|
70
|
+ if ($zip->open($this->rutaDiariaFecha . $fileName)) {
|
|
71
|
+ $zip->extractTo($this->rutaDiariaFecha);
|
|
72
|
+ $zip->close();
|
|
73
|
+ unlink($this->rutaDiariaFecha . $fileName);
|
|
74
|
+ $archivosTotales = get_filenames($this->rutaDiariaFecha);
|
|
75
|
+
|
|
76
|
+ foreach ($archivosTotales as $file) {
|
|
77
|
+ $this->getFile($this->rutaDiariaFecha . $file, $file);
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ }
|
67
|
81
|
|
68
|
|
- $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
|
69
|
|
- $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
|
|
82
|
+ }
|
70
|
83
|
|
71
|
|
- //while ($nuevoAtomAttrNext !== "") {
|
72
|
|
- $aux = 0;
|
73
|
|
- while ($aux <= 3) {
|
|
84
|
+ /*$archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
|
|
85
|
+ $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
|
74
|
86
|
|
75
|
|
- $fileName = basename($nuevoAtomAttrNext);
|
76
|
|
- $this->downloadFile($fileName, $nuevoAtomAttrNext, $this->rutaDiariaFecha);
|
77
|
|
- $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
|
|
87
|
+ while ($nuevoAtomAttrNext !== "") {
|
|
88
|
+ //$aux = 0;
|
|
89
|
+ //while ($aux <= 3) {
|
78
|
90
|
|
79
|
|
- $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
|
80
|
|
- $aux++;
|
81
|
|
- }
|
|
91
|
+ $fileName = basename($nuevoAtomAttrNext);
|
|
92
|
+ $this->downloadFile($fileName, $nuevoAtomAttrNext, $this->rutaDiariaFecha);
|
|
93
|
+ $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
|
|
94
|
+
|
|
95
|
+ $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
|
|
96
|
+ //$aux++;
|
|
97
|
+ }*/
|
82
|
98
|
}
|
83
|
99
|
|
84
|
100
|
private function getFile($url, $fileName)
|