echo "Config value {$keyword} = {$value}\n"; } } catch (ProtocolError $pe) { echo 'GETCONF failed: ' . $pe->getMessage(); } echo "\n"; // Get configuration values with non-existent values // GETCONF fails if any unknown options are present try { $config = $tc->getConf('ORPort NonExistentConfigValue DirPort AnotherFakeValue'); } catch (ProtocolError $pe) { echo 'GETCONF failed: ' . $pe->getMessage(); } echo "\n\n"; // Read config values into array $config = $tc->getConf('Log CookieAuthentication'); var_dump($config); //$config['Log'] = 'notice stderr'; //$config['Log'] = 'notice file /var/log/tor/tor.log'; // SETCONF using previously fetched config values $tc->setConf($config); // SETCONF with non-existent option // SETCONF fails and nothing is set if any unknown options are present try { // add non-existent config value to array $config['IDontExist'] = 'some string value'; $tc->setConf($config); } catch (\Exception $ex) { echo $ex->getMessage(); } $tc->quit();