1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| $archive = new PharData($nameZip);
$archive->buildFromDirectory($pathZip);
$data=array(
'name' => $nameZip,
'file' => base64_encode(file_get_contents($path))
);
$ch = curl_init();
$options = array(
CURLOPT_URL => 'https://monUrl/monFichier.php?pkey=xxxxxxxx',
CURLOPT_RETURNTRANSFER => true,
CURLINFO_HEADER_OUT => true, //Request header
CURLOPT_HEADER => true, //Return header
CURLOPT_HTTPHEADER => array('Content-Type: application/json'),
CURLOPT_SSL_VERIFYPEER => false, //Don't veryify server certificate
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data)
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
$header_info = curl_getinfo($ch,CURLINFO_HEADER_OUT);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($result, 0, $header_size);
$body = substr($result, $header_size);
curl_close($ch); |
Partager