Skip to content

Instantly share code, notes, and snippets.

@w33tmaricich
Last active June 25, 2018 14:04
Show Gist options
  • Save w33tmaricich/80d5ba435078be697371ea70e0b68b01 to your computer and use it in GitHub Desktop.
Save w33tmaricich/80d5ba435078be697371ea70e0b68b01 to your computer and use it in GitHub Desktop.
php: load and save xml
<?php
$fileName = "fun.xml";
$keystorepath = "this/is/a/path.jks";
$keystorepassword = "keystorepassword";
$fileContents = file_get_contents($fileName);
$xml = simplexml_load_string($fileContents);
foreach ($xml->Root->VHost->HostPortList->HostPort as $property) {
if ($property->Name == "Default SSL Streaming") {
$property->SSLConfig->KeyStorePath = $keystorepath;
$property->SSLConfig->KeyStorePassword = $keystorepassword;
$property->SSLConfig->KeyStoreType = "JKS";
//var_dump($property);
}
}
$xml->asXml($fileName);
echo "...done.";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment