本文整理汇总了PHP中Network::Create方法的典型用法代码示例。如果您正苦于以下问题:PHP Network::Create方法的具体用法?PHP Network::Create怎么用?PHP Network::Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network::Create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AppCentre_App_Check_ISBUY
function AppCentre_App_Check_ISBUY($appid)
{
global $zbp;
$postdate = array('email' => $zbp->Config('AppCentre')->shop_username, 'password' => $zbp->Config('AppCentre')->shop_password, 'appid' => $appid, );
$http_post = Network::Create();
$http_post->open('POST', APPCENTRE_API_URL . APPCENTRE_API_APP_ISBUY);
$http_post->setRequestHeader('Referer', substr($zbp->host, 0, -1) . $zbp->currenturl);
$http_post->send($postdate);
$result = json_decode($http_post->responseText, true);
return $result;
}
示例2: misc_statistic
function misc_statistic()
{
global $zbp;
$r = null;
$zbp->BuildTemplate();
$xmlrpc_address = $zbp->host . 'zb_system/xml-rpc/';
$current_member = $zbp->user->Name;
$current_version = $zbp->option['ZC_BLOG_VERSION'];
$all_artiles = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=0'), 'num');
$all_pages = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=1'), 'num');
$all_categorys = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Category']), 'num');
$all_comments = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Comment']), 'num');
$all_views = $zbp->option['ZC_VIEWNUMS_TURNOFF'] == true ? 0 : GetValueInArrayByCurrent($zbp->db->Query('SELECT SUM(log_ViewNums) AS num FROM ' . $GLOBALS['table']['Post']), 'num');
$all_tags = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) as num FROM ' . $GLOBALS['table']['Tag']), 'num');
$all_members = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Member']), 'num');
$current_theme = $zbp->theme;
$current_style = $zbp->style;
$current_member = '{$zbp->user->Name}';
$ajax = Network::Create();
if ($ajax) {
$ajax = substr(get_class($ajax), 7);
}
$system_environment = PHP_OS . ';' . GetValueInArray(explode(' ', str_replace(array('Microsoft-', '/'), array('', ''), GetVars('SERVER_SOFTWARE', 'SERVER'))), 0) . ';' . 'PHP' . phpversion() . ';' . $zbp->option['ZC_DATABASE_TYPE'] . ';' . $ajax;
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_member']}</td><td class='td30'>{$current_member}</td><td class='td20'>{$zbp->lang['msg']['current_version']}</td><td class='td30'>{$current_version}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_artiles']}</td><td>{$all_artiles}</td><td>{$zbp->lang['msg']['all_categorys']}</td><td>{$all_categorys}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_pages']}</td><td>{$all_pages}</td><td>{$zbp->lang['msg']['all_tags']}</td><td>{$all_tags}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_comments']}</td><td>{$all_comments}</td><td>{$zbp->lang['msg']['all_views']}</td><td>{$all_views}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_theme']}/{$zbp->lang['msg']['current_style']}</td><td>{$current_theme}/{$current_style}</td><td>{$zbp->lang['msg']['all_members']}</td><td>{$all_members}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['xmlrpc_address']}</td><td>{$xmlrpc_address}</td><td>{$zbp->lang['msg']['system_environment']}</td><td>{$system_environment}</td></tr>";
$zbp->cache->reload_statistic = $r;
$zbp->cache->reload_statistic_time = time();
$zbp->cache->system_environment = $system_environment;
//$zbp->SaveCache();
CountNormalArticleNums();
$zbp->AddBuildModule('statistics', array($all_artiles, $all_pages, $all_categorys, $all_tags, $all_views, $all_comments));
$zbp->BuildModule();
$r = str_replace('{#ZC_BLOG_HOST#}', $zbp->host, $r);
$r = str_replace('{$zbp->user->Name}', $zbp->user->Name, $r);
echo $r;
}
示例3: GetHttpContent
/**
* 通过URL获取远程页面内容
* @param string $url URL地址
* @return string 返回页面文本内容,默认为null
*/
function GetHttpContent($url)
{
if (class_exists('Network')) {
$ajax = Network::Create();
if (!$ajax) {
return null;
}
$ajax->open('GET', $url);
$ajax->enableGzip();
$ajax->setTimeOuts(60, 60, 0, 0);
$ajax->send();
return $ajax->responseText;
}
$r = null;
if (function_exists("curl_init") && function_exists('curl_exec')) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
if (ini_get("safe_mode") == false && ini_get("open_basedir") == false) {
curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
}
if (extension_loaded('zlib')) {
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
}
$r = curl_exec($ch);
curl_close($ch);
} elseif (ini_get("allow_url_fopen")) {
$r = file_get_contents((extension_loaded('zlib') ? 'compress.zlib://' : '') . $url);
}
return $r;
}
示例4: GetHttpContent
/**
* 通过URL获取远程页面内容
* @param string $url URL地址
* @return string 返回页面文本内容,默认为null
*/
function GetHttpContent($url)
{
if (class_exists('Network')) {
$ajax = Network::Create();
if (!$ajax) {
return null;
}
$ajax->open('GET', $url);
$ajax->enableGzip();
$ajax->setTimeOuts(60, 60, 0, 0);
$ajax->send();
if ($ajax->status == 200) {
return $ajax->responseText;
} else {
return null;
}
}
$r = null;
if (function_exists("curl_init") && function_exists('curl_exec')) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
if (ini_get("safe_mode") == false && ini_get("open_basedir") == false) {
curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
}
if (extension_loaded('zlib')) {
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
}
$r = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code == 200) {
return $r;
}
} elseif (ini_get("allow_url_fopen")) {
ZBlogException::SuspendErrorHook();
$http_response_header = null;
$r = file_get_contents((extension_loaded('zlib') ? 'compress.zlib://' : '') . $url);
if (is_array($http_response_header) && in_array('HTTP/1.1 200 OK', $http_response_header)) {
if ($r !== false) {
return $r;
}
}
ZBlogException::ResumeErrorHook();
}
return null;
}
示例5: postContents_curl
private function postContents_curl($aUrl, $aCommentsArray, $headerPart = array())
{
global $zbp;
$ajax = Network::Create();
if (!$ajax) {
throw new Exception('主机没有开启访问外部网络功能');
}
$ajax->open('POST', $aUrl);
if (get_class($ajax) != 'Networkfile_get_contents' || version_compare(PHP_VERSION, '5.3.0') >= 0) {
$ajax->enableGzip();
}
$ajax->setTimeOuts(360, 20, 0, 0);
$ajax->setRequestHeader('User-Agent', 'Z-BlogPHP/' . ZC_BLOG_VERSION . '|ChangYan/' . ChangYan_Handler::version);
$ajax->send($aCommentsArray);
return $ajax->responseText;
}
示例6: Server_SendRequest_Network
function Server_SendRequest_Network($url, $data = array(), $u, $c)
{
global $zbp;
$ajax = Network::Create();
if (!$ajax) {
throw new Exception('主机没有开启访问外部网络功能');
}
if ($data) {
//POST
$ajax->open('POST', $url);
$ajax->enableGzip();
$ajax->setTimeOuts(120, 120, 0, 0);
$ajax->setRequestHeader('User-Agent', $u);
$ajax->setRequestHeader('Cookie', $c);
$ajax->send($data);
} else {
$ajax->open('GET', $url);
$ajax->enableGzip();
$ajax->setTimeOuts(120, 120, 0, 0);
$ajax->setRequestHeader('User-Agent', $u);
$ajax->setRequestHeader('Cookie', $c);
$ajax->send();
}
return $ajax->responseText;
}