本文整理汇总了PHP中Ice_initialize函数的典型用法代码示例。如果您正苦于以下问题:PHP Ice_initialize函数的具体用法?PHP Ice_initialize怎么用?PHP Ice_initialize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Ice_initialize函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init_ICE
/**
* Create's a ICE object
*
* @return ice object
*/
private function init_ICE()
{
global $ICE;
$ICE = Ice_initialize();
$base = Murmur_MetaPrxHelper::checkedCast($ICE->stringToProxy('Meta:tcp -h ' . $_SESSION['mumip'] . ' -p 6502')->ice_context($_SESSION['icepass']));
return $base;
}
示例2: allTests
function allTests($communicator)
{
global $NS;
echo "testing setACM/getACM... ";
flush();
$ref = "communicator:default -p 12010";
$com = $communicator->stringToProxy($ref)->ice_uncheckedCast("::Test::RemoteCommunicator");
$adapter = $com->createObjectAdapter(-1, -1, -1);
$initData = $NS ? eval("return new Ice\\InitializationData;") : new Ice_InitializationData;
$initData->properties = $communicator->getProperties()->clone();
$initData->properties->setProperty("Ice.ACM.Timeout", "1");
$initData->properties->setProperty("Ice.ACM.Client.Timeout", "15");
$initData->properties->setProperty("Ice.ACM.Client.Close", "4");
$initData->properties->setProperty("Ice.ACM.Client.Heartbeat", "2");
$testCommunicator = $NS ? eval("return Ice\\initialize(\$initData);") : Ice_initialize($initData);
$proxy = $testCommunicator->stringToProxy($adapter->getTestIntf()->ice_toString())->ice_uncheckedCast(
"::Test::TestIntf");
$proxy->ice_getConnection();
$CloseOnIdleForceful =
$NS ? constant("Ice\\ACMClose::CloseOnIdleForceful") : constant("Ice_ACMClose::CloseOnIdleForceful");
$CloseOnInvocationAndIdle =
$NS ? constant("Ice\\ACMClose::CloseOnInvocationAndIdle") : constant("Ice_ACMClose::CloseOnInvocationAndIdle");
$HeartbeatOnIdle =
$NS ? constant("Ice\\ACMHeartbeat::HeartbeatOnIdle") : constant("Ice_ACMHeartbeat::HeartbeatOnIdle");
$HeartbeatOnInvocation =
$NS ? constant("Ice\\ACMHeartbeat::HeartbeatOnInvocation") :
constant("Ice_ACMHeartbeat::HeartbeatOnInvocation");
$acm = $proxy->ice_getCachedConnection()->getACM();
test($acm->timeout == 15);
test($acm->close == $CloseOnIdleForceful);
test($acm->heartbeat == $HeartbeatOnIdle);
$proxy->ice_getCachedConnection()->setACM(Ice_Unset, Ice_Unset, Ice_Unset);
$acm = $proxy->ice_getCachedConnection()->getACM();
test($acm->timeout == 15);
test($acm->close == $CloseOnIdleForceful);
test($acm->heartbeat == $HeartbeatOnIdle);
$proxy->ice_getCachedConnection()->setACM(20, $CloseOnInvocationAndIdle, $HeartbeatOnInvocation);
$acm = $proxy->ice_getCachedConnection()->getACM();
test($acm->timeout == 20);
test($acm->close == $CloseOnInvocationAndIdle);
test($acm->heartbeat == $HeartbeatOnInvocation);
$adapter->deactivate();
$testCommunicator->destroy();
echo "ok\n";
echo "shutting down... ";
flush();
$com->shutdown();
echo "ok\n";
}
示例3: __construct
function __construct()
{
// Check that the PHP Ice extension is loaded.
if (!extension_loaded('ice')) {
MessageManager::addError(tr('error_noIceExtensionLoaded'));
} else {
$this->contextVars = SettingsManager::getInstance()->getDbInterface_iceSecrets();
if (!function_exists('Ice_intVersion') || Ice_intVersion() < 30400) {
// ice 3.3
global $ICE;
Ice_loadProfile();
$this->conn = $ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address());
$this->meta = $this->conn->ice_checkedCast("::Murmur::Meta");
// use IceSecret if set
if (!empty($this->contextVars)) {
$this->meta = $this->meta->ice_context($this->contextVars);
}
$this->meta = $this->meta->ice_timeout(10000);
} else {
// ice 3.4
$initData = new Ice_InitializationData();
$initData->properties = Ice_createProperties();
$initData->properties->setProperty('Ice.ImplicitContext', 'Shared');
$ICE = Ice_initialize($initData);
/*
* getImplicitContext() is not implemented for icePHP yet…
* $ICE->getImplicitContext();
* foreach ($this->contextVars as $key=>$value) {
* $ICE->getImplicitContext()->put($key, $value);
* }
*/
try {
$this->meta = Murmur_MetaPrxHelper::checkedCast($ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address()));
$this->meta = $this->meta->ice_context($this->contextVars);
} catch (Ice_ConnectionRefusedException $exc) {
MessageManager::addError(tr('error_iceConnectionRefused'));
}
}
$this->connect();
}
}
示例4: test
test($b->_public == 0);
test($b->_this == 0);
test($b->_throw == 0);
test($b->_use == 0);
test($b->_var == 0);
$p = $communicator->stringToProxy("test:tcp -p 10000");
$c = $NS ? eval("return _and\\functionPrxHelper::uncheckedCast(\$p);") :
eval("return and_functionPrxHelper::uncheckedCast(\$p);");
$d = $NS ? eval("return _and\\diePrxHelper::uncheckedCast(\$p);") :
eval("return and_diePrxHelper::uncheckedCast(\$p);");
$e = $NS ? eval("return _and\\echoPrxHelper::uncheckedCast(\$p);") :
eval("return and_echoPrxHelper::uncheckedCast(\$p);");
$e1 = new echoI();
$f = $NS ? eval("return _and\\enddeclarePrxHelper::uncheckedCast(\$p);") :
eval("return and_enddeclarePrxHelper::uncheckedCast(\$p);");
$f1 = new enddeclareI();
$g = $NS ? eval("return new _and\\_endif();") : eval("return new and_endif();");
$h = $NS ? eval("return new _and\\_endwhile();") : eval("return new and_endwhile();");
$i = $NS ? constant("_and\\_or") : constant("and_or");
$j = $NS ? constant("_and\\_print") : constant("and_print");
$j = $NS ? constant("_and\\_require_once") : constant("and_require_once");
echo "ok\n";
}
$communicator = Ice_initialize(&$argv);
allTests($communicator);
$communicator->destroy();
exit();
?>
示例5: foreach
else{
foreach (range($start, $end) as $number) {
mysql_connect("$host", "$user", "$pwd") or die(mysql_error());
mysql_select_db("$database") or die(mysql_error());
$result = mysql_query("SELECT * FROM users WHERE id = '$number' AND mum_active = '1' ")
or die(mysql_error());
$row = mysql_fetch_array( $result );
$uid = $row['id'];
if (empty($uid)) {
echo $number . " not a valid userid.<br/>";
continue;
}
$mhost = $row['mum_host'];
$result2 = mysql_query("SELECT * FROM mservers WHERE hostname = '$mhost'");
$muminfo = mysql_fetch_array( $result2 );
$icepass = array('secret'=>''.$muminfo['icepass'].'');
$mip = $muminfo['ip'];
$ICE = Ice_initialize();
$meta = Murmur_MetaPrxHelper::checkedCast($ICE->stringToProxy('Meta:tcp -h '. $mip .' -p 6502')->ice_context($icepass));
$sid = $row['mum_id'];
$meta->getServer(intval($sid))->ice_context($icepass)->setConf('bandwidth', '72000');
echo $row['email'];
echo " ". $row['mum_port'] ." updated conf value.<br/>";
sleep(3);
}
}
?>
示例6: Ice_initialize
<?php
require 'Ice.php';
require 'sms.php';
$ic = null;
try {
$ic = Ice_initialize();
//初始化ice的客户端
$base = $ic->stringToProxy("sms:default -h localhost -p 10000");
//创建代理参数
$proxy = SMS_SmsSendPrxHelper::checkedCast($base);
//建立代理链接
if (!$proxy) {
throw new RuntimeException("Invalid proxy");
}
//调用接口,这是一个测试接口
$result = $proxy->test();
print_r($result);
//以下的所有接口都是我们的服务提供的接口
// $phones:单个或多个电话号码字符串,多个电话号码以逗号分割
// $phone:单个电话号码
// $tempId:短信模板ID,可以通过getSmsTemplates()获取所有的短信模板
// $date:发送时间,格式为"yyyy-MM-dd HH:mm:ss"
// $code:短信验证码
// $result = $proxy->sendStandard($phones, $tempId);
// $result = $proxy->sendScheduler($phones, $message, $date);
// $result = $proxy->sendIdentifyingCode($phone, $tempId);
// $result = $proxy->checkIdentifyingCode($phone, $code);
// $result = $proxy->getSmsTemplates();
// print_r($result);
} catch (Exception $ex) {
示例7: exit
echo "\ntest failed in " . $bt[0]["file"] . " line " . $bt[0]["line"] . "\n";
exit(1);
}
}
$NS = function_exists("Ice\\initialize");
require_once $NS ? 'Ice_ns.php' : 'Ice.php';
//
// Load the Demo profile.
//
$communicator = null;
if ($NS) {
$initData = eval("return new Ice\\InitializationData;");
$initData->properties = eval("return Ice\\getProperties();");
$communicator = eval("return Ice\\initialize(\$initData);");
} else {
$initData = new Ice_InitializationData();
$initData->properties = Ice_getProperties();
$communicator = Ice_initialize($initData);
}
test($communicator != null);
$properties = null;
if ($NS) {
$properties = eval("return Ice\\getProperties(\"Test\");");
} else {
$properties = Ice_getProperties("Test");
}
test($properties != null);
test($properties->getPropertyAsInt("Ice.Trace.Protocol") == 1);
test($properties->getPropertyAsInt("Ice.Trace.Network") == 1);
test($properties->getPropertyAsInt("Ice.Warn.Connections") == 1);
test($properties->getProperty("Hello.Proxy") == "hello:tcp -h localhost -p 10000");
示例8: initIce34
private function initIce34()
{
// ice 3.4
$initData = new Ice_InitializationData();
$initData->properties = Ice_createProperties();
$initData->properties->setProperty('Ice.ImplicitContext', 'Shared');
$initData->properties->setProperty('Ice.Default.EncodingVersion', '1.0');
$ICE = Ice_initialize($initData);
/*
* getImplicitContext() is not implemented for icePHP yet…
* $ICE->getImplicitContext();
* foreach ($this->contextVars as $key=>$value) {
* $ICE->getImplicitContext()->put($key, $value);
* }
* which should result in
* $ICE->getImplicitContext()->put('secret', 'ts');
* $ICE->getImplicitContext()->put('icesecret', 'ts');
*/
try {
$this->meta = Murmur_MetaPrxHelper::checkedCast($ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address()));
$this->meta = $this->meta->ice_context($this->contextVars);
//TODO: catch ProxyParseException, EndpointParseException, IdentityParseException from stringToProxy()
} catch (Ice_ConnectionRefusedException $exc) {
MessageManager::addError(tr('error_iceConnectionRefused'));
}
}
示例9: unset
unset($_SESSION['authenticated']);
Ice_unregister(session_id());
echo "<P><HR><I>Destroyed previous session.</I><HR></P>\n";
}
//
// Generate a new session ID.
//
session_regenerate_id();
if (isset($_POST["submitted"])) {
//
// Initialize a communicator using the default properties.
//
$initData = new Ice_InitializationData();
$initData->properties = Ice_createProperties();
$initData->properties->setProperty("Ice.Default.Router", "DemoGlacier2/router:tcp -p 4063 -h localhost");
$ICE = Ice_initialize($initData);
try {
//
// Verify that we are using a Glacier2 router.
//
$router = Glacier2_RouterPrxHelper::checkedCast($ICE->getDefaultRouter());
if ($router == null) {
echo "<P><HR><B>Configured router is not a Glacier2 router.</B><HR></P>\n";
die;
}
$user = "";
$password = "";
if (isset($_POST["user"])) {
$user = $_POST["user"];
}
if (isset($_POST["password"])) {
示例10: set_include_path
}
$includePath .= $iceIncludePath;
set_include_path($includePath);
}
require_once 'Ice.php';
require_once dirname(__FILE__) . '/SessionI.php';
require_once dirname(__FILE__) . '/PollingChat.php';
$data = new Ice_InitializationData();
$data->properties = Ice_getProperties();
if ($data->properties->getProperty("PollingChatSessionFactory") == '') {
$data->properties->setProperty("Ice.Plugin.IceSSL", "IceSSL:createIceSSL");
$data->properties->setProperty("IceSSL.UsePlatformCAs", "1");
$data->properties->setProperty("IceSSL.CheckCertName", "1");
$data->properties->setProperty("PollingChatSessionFactory", "PollingChatSessionFactory:wss -h zeroc.com -p 443 -r /demo-proxy/chat/poll");
}
$communicator = Ice_initialize($data);
//
// Disable session cookie.
//
ini_set("session.use_cookies", false);
//
// Disable transid in urls.
//
ini_set("session.session.use_transid", false);
if (isset($_POST['id'])) {
session_id($_POST['id']);
}
//
// Disable caching
//
header("Cache-Control: no-cache, must-revalidate");