'; echo ' '; echo ' Calling .NET from PHP through COM'; echo ' '; echo ' '; echo ''; echo '

Hello!

' . "
\n"; echo '

Trying static method

' . "
\n"; $fname = "archive-" . date('Y-m-d-His') . ".zip"; echo 'Dynamically generated archive name: ' . "\n" . '

' . $fname . "

\n"; $zipOutput = "c:\\temp\\php-" . $fname; $zipfact = new COM("Ionic.Zip.ZipFile"); $zip = $zipfact->Read($zipOutput); $zip->Encryption = 3; $zip->Password = "AES-Encryption-Is-Secure"; $dirToZip= "c:\\temp\\psh"; $zip->AddDirectory($dirToZip); $zip->Save(); echo '
The file was saved to ' . $zip->Name . '
' . "\n"; $zip->Dispose(); echo ''; echo ''; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; echo '
';
  echo $e->getTraceAsString(), "\n";
  echo '
'; } ?>