本文整理汇总了PHP中uc_fopen函数的典型用法代码示例。如果您正苦于以下问题:PHP uc_fopen函数的具体用法?PHP uc_fopen怎么用?PHP uc_fopen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uc_fopen函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: uc_fopen2
function uc_fopen2($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE)
{
$__times__ = isset($_GET['__times__']) ? intval($_GET['__times__']) + 1 : 1;
if ($__times__ > 2) {
return '';
}
$url .= (strpos($url, '?') === FALSE ? '?' : '&') . "__times__={$__times__}";
return uc_fopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block);
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:9,代码来源:client.php
示例2: doucenter
function doucenter()
{
$d_url = 'index.php?admin_setting-ucenter';
if (isset($this->post['submit'])) {
$settings['ucopen'] = $this->post['ucopen'];
$settings['feed'] = serialize($this->post['feed']);
$setting = $_ENV['setting']->update_setting($settings);
$this->cache->removecache('setting');
$this->message('UCenter设置成功!', $d_url);
} elseif (isset($this->post['ucsubmit'])) {
$ucopen = 1;
$ucapi = $this->post['ucapi'];
$ucpassword = $this->post['ucpassword'];
$ucip = $this->post['ucip'];
$ucapi = preg_replace("/\\/\$/", '', trim($ucapi));
$ucip = trim($ucip);
if (empty($ucapi) || !preg_match("/^(http:\\/\\/)/i", $ucapi)) {
$this->message('您输入的URL地址不正确!', $d_url);
}
if (!$ucip) {
$temp = @parse_url($ucapi);
$ucip = gethostbyname($temp['host']);
if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) {
$ucip = '';
}
}
define('UC_API', true);
if (!@(include_once HDWIKI_ROOT . '/api/uc_client/client.php')) {
$this->message('uc_client目录不存在。', $d_url);
}
$ucinfo = uc_fopen($ucapi . '/index.php?m=app&a=ucinfo&release=' . UC_CLIENT_RELEASE, 500, '', '', 1, $ucip);
list($status, $ucversion, $ucrelease, $uccharset, $ucdbcharset, $apptypes) = explode('|', $ucinfo);
if ($status != 'UC_STATUS_OK') {
$this->message('uc_url_unreachable', $d_url);
} else {
$dbcharset = strtolower(str_replace('-', '', trim(WIKI_CHARSET)));
$ucdbcharset = strtolower(str_replace('-', '', $ucdbcharset));
if (UC_CLIENT_VERSION > $ucversion) {
$this->message('uc_version_incorrect', $d_url);
} elseif ($dbcharset && $ucdbcharset != $dbcharset) {
$this->message('uc_dbcharset_incorrect', $d_url);
}
$tagtemplates = '';
$app_url = WIKI_URL;
$postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucpassword) . "&apptype=" . urlencode('OTHER') . "&appname=" . urlencode('HDWIKI') . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . $dbcharset . '&appdbcharset=' . $dbcharset . '&' . $tagtemplates . '&release=' . UC_CLIENT_RELEASE;
$s = uc_fopen($ucapi . '/index.php', 500, $postdata, '', 1, $ucip);
if (empty($s)) {
$this->message('不能连接到 UCenter 服务端。', $d_url);
} elseif ($s == '-1') {
$this->message('UCenter 密码错误。', $d_url);
} else {
$ucs = explode('|', $s);
if (empty($ucs[0]) || empty($ucs[1])) {
$this->message('UCenter 不能返回数据。', $d_url);
}
}
$ucdata = "<?php\r\n\t\t\t\t\tdefine('UC_OPEN','{$ucopen}');\r\n\t\t\t\t\tdefine('UC_CONNECT', 'uc_api_post');\r\n\r\n\t\t\t\t\tdefine('UC_DBHOST', '{$ucs[2]}');\r\n\t\t\t\t\tdefine('UC_DBUSER', '{$ucs[4]}');\r\n\t\t\t\t\tdefine('UC_DBPW', '{$ucs[5]}');\r\n\t\t\t\t\tdefine('UC_DBNAME', '{$ucs[3]}');\r\n\t\t\t\t\tdefine('UC_DBCHARSET', '{$ucs[6]}');\r\n\t\t\t\t\tdefine('UC_DBTABLEPRE', '{$ucs[7]}');\r\n\r\n\t\t\t\t\tdefine('UC_KEY', '{$ucs[0]}');\r\n\t\t\t\t\tdefine('UC_API', '{$ucapi}');\r\n\t\t\t\t\tdefine('UC_CHARSET', '{$ucs[8]}');\r\n\t\t\t\t\tdefine('UC_IP', '{$ucip}');\r\n\t\t\t\t\tdefine('UC_APPID', '{$ucs[1]}');\r\n\t\t\t\t\t?>";
$byte = file::writetofile(HDWIKI_ROOT . '/api/ucconfig.inc.php', $ucdata);
if ($byte == 0) {
$this->message('不能写ucconfig.inc.php文件。', $d_url);
}
$this->message('UCenter 设置成功!', $d_url);
}
} elseif (isset($this->post['import'])) {
set_time_limit(0);
$url = HDWIKI_ROOT . '/api/ucconfig.inc.php';
if (!file_exists($url)) {
$this->message('您还没有设置过UCenter!', 'BACK');
} else {
include $url;
if (!(UC_OPEN && isset($this->setting['ucopen']) && $this->setting['ucopen'])) {
$this->message('您还没有开通ucenter!', 'BACK');
}
$url = HDWIKI_ROOT . "/data/import_uc.lock";
if (file_exists($url)) {
$this->message('您已经导入过用户,想重新导入请删除' . $url . '文件。', 'BACK');
}
}
#包含uc相应文件。
require_once HDWIKI_ROOT . '/api/uc_client/client.php';
require_once HDWIKI_ROOT . '/api/uc_client/lib/db.class.php';
#
#实例uc数据类
$ucdb = new db();
$ucdb->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE);
#
$this->load('user');
$ucuserlist = '';
$usercount = $_ENV['user']->get_total_num('', 0);
for ($i = 0; $i < $usercount; $i = $i + 100) {
$userlist = $_ENV['user']->get_list('', 0, $i, 100);
foreach ($userlist as $temUser) {
if (uc_get_user($temUser['username'])) {
$ucuserlist .= "username:" . $temUser['username'] . "\tuser_email:" . $temUser['email'] . "\r\n";
} else {
$salt = substr(uniqid(rand()), -6);
$password = md5($temUser['password'] . $salt);
$ucdb->query("INSERT INTO " . UC_DBTABLEPRE . "members SET username='" . $temUser['username'] . "', password='{$password}', email='" . $temUser['email'] . "', regip='" . $temUser['regip'] . "', regdate='" . time() . "', salt='" . $salt . "'");
$uid = $ucdb->insert_id();
$ucdb->query("INSERT INTO " . UC_DBTABLEPRE . "memberfields SET uid='{$uid}'");
//.........这里部分代码省略.........
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:101,代码来源:admin_setting.php
示例3: fsocketopen
$host = "uc.gongchang.com";
$port = 80;
$timeout = 20;
$rs = fsocketopen($ip ? $ip : $host, $port, $errno, $errstr, $timeout);
var_dump($rs);
exit;
define("HTTP_USER_AGENT", "user_agent");
$url = "http://uc.gongchang.com/index.php?__times__=1";
$limit = 500000;
$post = "m=user&a=logincheck&inajax=2&release=20141101&input=fd14gacr90GxmjjEO3QWYa0iw48epTyJ6SG9HT8fvDfxAjT62greyxq%2BkWPZKN9xUO3V%2BLtfVBiClw1sc4pu4mA5j8vLz%2BMoivs16bXXCyexSuGgNLn7jwTyi3KGQP%2BawH5wzE9Frls7599G6hklEIs3HA&appid=31";
$cookie = "";
$bysocket = true;
$ip = "";
$timeout = 20;
$_SERVER[HTTP_USER_AGENT] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36 OPR/33.0.1990.58";
uc_fopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout);
function uc_fopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = false, $ip = '', $timeout = 15, $block = true)
{
$return = '';
$matches = parse_url($url);
!isset($matches['scheme']) && ($matches['scheme'] = '');
!isset($matches['host']) && ($matches['host'] = '');
!isset($matches['path']) && ($matches['path'] = '');
!isset($matches['query']) && ($matches['query'] = '');
!isset($matches['port']) && ($matches['port'] = '');
$scheme = $matches['scheme'];
$host = $matches['host'];
$path = $matches['path'] ? $matches['path'] . ($matches['query'] ? '?' . $matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80;
if ($post) {
$out = "POST {$path} HTTP/1.0\r\n";
开发者ID:tianyunchong,项目名称:php,代码行数:31,代码来源:uc_api.php
示例4: define
UC_API ? UC_API : define(UC_API, $settingnew['UC_API']);
require_once S_ROOT . '/uc_client/client.php';
$ucinfo = uc_fopen($ucapi . '/index.php?m=app&a=ucinfo&release=' . UC_CLIENT_RELEASE, 500, '', '', 1, $ucip);
list($status, $ucversion, $ucrelease, $uccharset, $ucdbcharset, $apptypes) = explode('|', $ucinfo);
if ($status != 'UC_STATUS_OK') {
kekezu::admin_show_msg($_lang['uc_communication_fail'], 'index.php?do=config&view=integration&type=uc', 3, '', 'warning');
} else {
$dbcharset = strtolower(DBCHARSET ? str_replace('-', '', DBCHARSET) : 'utf8');
$ucdbcharset = strtolower($settingnew['UC_DBCHARSET'] ? str_replace('-', '', $settingnew['UC_DBCHARSET']) : $settingnew['UC_DBCHARSET']);
if (UC_CLIENT_VERSION > $ucversion) {
kekezu::admin_show_msg($_lang['uc_different_version'], 'index.php?do=config&view=integration&type=uc', 3, '', 'warning');
} elseif ($dbcharset && $ucdbcharset != $dbcharset) {
kekezu::admin_show_msg($_lang['uc_different_coding'], 'index.php?do=config&view=integration&type=uc', 3, '', 'warning');
}
$postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($ucfounderpw) . "&apptype=" . urlencode($app_type) . "&appname=" . urlencode($app_name) . "&appurl=" . urlencode($app_url) . "&appip=&appcharset=" . CHARSET . '&appdbcharset=' . DBCHARSET . '&' . $app_tagtemplates . '&release=' . UC_CLIENT_RELEASE;
$ucconfig = uc_fopen($ucapi . '/index.php', 500, $postdata, '', 1, $ucip);
if (empty($ucconfig)) {
kekezu::admin_show_msg($_lang['uc_app_fail_to_add'], 'index.php?do=config&view=integration&type=uc', '', 3, 'warning');
} elseif ($ucconfig == '-1') {
kekezu::admin_show_msg($_lang['uc_error_author_password'], 'index.php?do=config&view=integration&type=uc', 3, '', 'warning');
} else {
list($appauthkey, $appid) = explode('|', $ucconfig);
if (empty($appauthkey) || empty($appid)) {
kekezu::admin_system_log($_lang['add_log_msg']);
kekezu::admin_show_msg(keke::lang('uc_app_invalid_to_add'), 'index.php?do=config&view=integration&type=uc', 3, '', 'success');
}
}
}
$ucconfig_info = explode('|', $ucconfig);
$config_ucenter = keke_tpl_class::sreadfile(S_ROOT . "/config/config_ucenter.php");
$config_ucenter = preg_replace("/define\\('UC_KEY',\\s*'.*?'\\);/s", "define('UC_KEY', '" . $ucconfig_info['0'] . "');", $config_ucenter);
开发者ID:huangbinzd,项目名称:kppwGit,代码行数:31,代码来源:admin_config_integration.php
注:本文中的uc_fopen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论