Mohammad Reza
Mohammad Reza

Reputation: 1203

extract kmz file with php

Hi I want to extract a KMZ file that has an Images folder with some images and a kml file

Other questions here just have the kml file but mine has a images folder too! how can I extract it? I tried this but it didn't work

$data = file_get_contents("test/test.kmz"); // url of the KMZ file
file_put_contents("/test/kmz_temp",$data);
ob_start();
passthru('unzip -p /test/kmz_temp');
$xml_data = ob_get_clean();
header("Content-type: text/xml");
dd($xml_data);

and also this

$zip = new ZipArchive();
$zip->open('test/test.kmz');
$zip->extractTo('/test/public');
$zip->close();**strong text**

Upvotes: 1

Views: 1376

Answers (1)

Mohammad Reza
Mohammad Reza

Reputation: 1203

I found my solution

if you change the format of the file (while moving it to your folder) to zip it will extract it

Upvotes: 2

Related Questions