本文整理汇总了PHP中dfsockopen函数的典型用法代码示例。如果您正苦于以下问题:PHP dfsockopen函数的具体用法?PHP dfsockopen怎么用?PHP dfsockopen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dfsockopen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getdata
function getdata($style, $parameter)
{
$array = array();
foreach ($parameter as $key => $value) {
if (is_array($value)) {
$parameter[$key] = implode(',', $value);
}
}
$parameter['clientid'] = $this->blockdata['clientid'];
$parameter['op'] = 'getdata';
$parameter['charset'] = CHARSET;
$parameter['version'] = $this->blockdata['version'];
$xmlurl = $this->blockdata['url'];
$parse = parse_url($xmlurl);
if (!empty($parse['host'])) {
define('IN_ADMINCP', true);
require_once libfile('function/importdata');
$importtxt = @dfsockopen($xmlurl, 0, create_sign_url($parameter, $this->blockdata['key'], $this->blockdata['signtype']));
} else {
$importtxt = @file_get_contents($xmlurl);
}
if ($importtxt) {
require libfile('class/xml');
$array = xml2array($importtxt);
}
$idtype = 'xml_' . $this->blockdata['id'];
foreach ($array['data'] as $key => $value) {
$value['idtype'] = $idtype;
$array['data'][$key] = $value;
}
if (empty($array['data'])) {
$array['data'] = null;
}
return $array;
}
示例2: connect_output_php
function connect_output_php($url, $postData = '')
{
global $_G;
$response = dfsockopen($url, 0, $postData, '', false, $_G['setting']['cloud_api_ip']);
$result = (array) unserialize($response);
return $result;
}
示例3: check_patch
public function check_patch($ignore = 0)
{
global $_G;
if (!$ignore && $_G['cookie']['checkpatch']) {
return false;
}
require_once DISCUZ_ROOT . 'source/discuz_version.php';
require_once libfile('class/xml');
$versionpath = '';
foreach (explode(' ', substr(DISCUZ_VERSION, 1)) as $unit) {
$versionpath = $unit;
break;
}
$patchdir = 'http://upgrade.discuz.com/DiscuzX/' . $versionpath . '/';
$checkurl = $patchdir . 'md5sums';
$patchlist = dfsockopen($checkurl);
if (defined('DISCUZ_FIXBUG')) {
C::t('common_patch')->update_status_by_serial(1, DISCUZ_FIXBUG, '<=');
}
if ($patchlist) {
$serial_md5s = explode("\r\n", $patchlist);
$bound = intval(substr($serial_md5s[count($serial_md5s) - 2], 0, 8));
$maxpatch = intval(C::t('common_patch')->fetch_max_serial());
if (defined('DISCUZ_FIXBUG')) {
$maxpatch = $maxpatch < DISCUZ_FIXBUG ? DISCUZ_FIXBUG : $maxpatch;
}
if ($bound > $maxpatch) {
$insertarrlist = array();
foreach ($serial_md5s as $serial_md5) {
$downloadpatch = $patch = '';
list($serial, $md5, $release) = explode(' ', $serial_md5);
if ($serial > $maxpatch && (!$release || in_array(DISCUZ_RELEASE, explode(',', $release)))) {
$downloadpatch = $patchdir . $serial . '.xml';
$patch = dfsockopen($downloadpatch);
if (md5($patch) != $md5) {
continue;
}
$patch = xml2array($patch);
if (is_array($patch) && !empty($patch)) {
$insertarr = array('serial' => intval($patch['serial']), 'rule' => serialize($patch['rule']), 'note' => $patch['note'], 'status' => 0, 'dateline' => $patch['dateline']);
C::t('common_patch')->insert($insertarr);
$insertarrlist[$insertarr['serial']] = $insertarr;
}
}
}
if ($insertarrlist && $_G['setting']['patch']['autoopened']) {
foreach ($insertarrlist as $key => $patch) {
$this->fix_patch($patch);
}
}
if ($insertarrlist) {
C::t('common_setting')->update('showpatchnotice', 1);
include_once libfile('function/cache');
updatecache('setting');
}
}
}
dsetcookie('checkpatch', 1, 60);
return true;
}
示例4: getremotefile
function getremotefile($file) {
@set_time_limit(0);
$file = $file.'?'.time().rand(1000, 9999);
$str = @implode('', @file($file));
if(!$str) {
$str = dfsockopen($file);
}
return $str;
}
示例5: down
function down($file, $subfolder = '')
{
global $plugin_lang, $program_ver, $plugin_dir, $plugin_id;
$temp = dfsockopen("http://dsu.googlecode.com/svn/trunk/PluginUpdater/{$plugin_id}/{$file}");
if (!$temp) {
cpmsg("下载文件 {$file} 失败,请稍候再试", '', 'error');
}
@unlink($plugin_dir . '/' . ($subfolder ? $subfolder . '/' : '') . $file);
file_put_contents($plugin_dir . '/' . ($subfolder ? $subfolder . '/' : '') . $file, $temp);
}
示例6: uc_check_avatar
function uc_check_avatar($uid, $size = 'middle', $type = 'virtual')
{
global $_G;
$url = $_G['siteurl'] . "avatar.php?uid={$uid}&size={$size}&type={$type}&check_file_exists=1";
$res = dfsockopen($url, 500000, '', '', TRUE, '', 20);
if ($res == 1) {
return 1;
} else {
return 0;
}
}
示例7: getResponse
private function getResponse($action)
{
global $_G;
$response = @dfsockopen($this->_myurl, 0, $this->getGlobalPostString($action), '', false, $_G['setting']['my_ip']);
$result = unserialize($response);
if (!$response) {
throw new Cloud_Service_Client_RestfulException('Empty Response', 111);
} elseif (!$result) {
throw new Cloud_Service_Client_RestfulException('Error Response: ' . $response, 110);
}
if ($result['errCode']) {
throw new Cloud_Service_Client_RestfulException($result['errMessage'], $result['errCode']);
}
return $result;
}
示例8: hux_get_data
function hux_get_data($url)
{
global $_G;
if (function_exists('curl_init')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_REFERER, $_G['siteurl']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
} else {
$result = dfsockopen($url);
}
return $result;
}
示例9: ajax_get_expressOp
/**
* 从第三方取快递信息
*/
public function ajax_get_expressOp(){
$url = 'http://www.kuaidi100.com/query?type='.$_GET['e_code'].'&postid='.$_GET['shipping_code'].'&id=1&valicode=&temp='.random(4).'&sessionid=&tmp='.random(4);
import('function.ftp');
$content = dfsockopen($url);
$content = json_decode($content,true);
if ($content['status'] != 200) exit(json_encode(false));
$content['data'] = array_reverse($content['data']);
$output = array();
if (is_array($content['data'])){
foreach ($content['data'] as $k=>$v) {
if ($v['time'] == '') continue;
$output[]= $v['time'].' '.$v['context'];
}
}
if (empty($output)) exit(json_encode(false));
echo json_encode($output);
}
示例10: getRequest
public function getRequest($requestURL, $extra = array(), $oauthMethod = 'GET', $multi = array())
{
if ($multi) {
$imageFile = $this->_getImageBinary($multi);
$extra = array_merge($extra, $imageFile['binary']);
}
$params = $this->_getOAuthSignatureParams($extra);
$params['oauth_signature'] = $this->_getOAuthSignature($requestURL, $params, $oauthMethod, $multi ? TRUE : FALSE);
$queryString = $this->_httpBuildQuery($params, $imageFile['fileInfo']);
if ($oauthMethod == 'GET') {
$requestURL = $requestURL . '?' . $queryString;
$queryString = '';
} else {
$requestURL = $requestURL . '?';
}
$response = dfsockopen($requestURL, 0, $queryString, '', false, $this->_apiIp, 15, TRUE, !$multi ? 'URLENCODE' : 'FORMDATA', false);
return $response;
}
示例11: trade_notifycheck
function trade_notifycheck($type)
{
global $_G;
if (!empty($_POST)) {
$notify = $_POST;
$location = FALSE;
} elseif (!empty($_GET)) {
$notify = $_GET;
$location = TRUE;
} else {
exit('Access Denied');
}
unset($notify['diy']);
if (dfsockopen("http://notify.alipay.com/trade/notify_query.do?partner=" . DISCUZ_PARTNER . "¬ify_id=" . $notify['notify_id'], 60) !== 'true') {
exit('Access Denied');
}
if ($type == 'trade') {
$urlstr = '';
foreach ($notify as $key => $val) {
MAGIC_QUOTES_GPC && ($val = stripslashes($val));
$urlstr .= $key . '=' . rawurlencode(stripslashes($val)) . '&';
}
} else {
ksort($notify);
$sign = '';
foreach ($notify as $key => $val) {
if ($key != 'sign' and $key != 'sign_type') {
$sign .= "&{$key}={$val}";
}
}
if ($notify['sign'] != md5(substr($sign, 1) . DISCUZ_SECURITYCODE)) {
exit('Access Denied');
}
}
if ($type == 'credit' && (!DISCUZ_DIRECTPAY && $notify['notify_type'] == 'trade_status_sync' && ($notify['trade_status'] == 'WAIT_SELLER_SEND_GOODS' || $notify['trade_status'] == 'TRADE_FINISHED') || DISCUZ_DIRECTPAY && ($notify['trade_status'] == 'TRADE_FINISHED' || $notify['trade_status'] == 'TRADE_SUCCESS')) || $type == 'trade' && $notify['notify_type'] == 'trade_status_sync') {
return array('validator' => TRUE, 'status' => trade_getstatus(!empty($notify['refund_status']) ? $notify['refund_status'] : $notify['trade_status'], 1), 'order_no' => $notify['out_trade_no'], 'price' => !DISCUZ_DIRECTPAY && $notify['price'] ? $notify['price'] : $notify['total_fee'], 'trade_no' => $notify['trade_no'], 'notify' => 'success', 'location' => $location);
} else {
return array('validator' => FALSE, 'notify' => 'fail', 'location' => $location);
}
}
示例12: sync
public function sync()
{
global $_G;
$setting = $_G['setting'];
$my_url = 'http://api.manyou.com/uchome.php';
$mySiteId = empty($_G['setting']['my_siteid']) ? '' : $_G['setting']['my_siteid'];
$siteName = $_G['setting']['bbname'];
$siteUrl = $_G['siteurl'];
$ucUrl = rtrim($_G['setting']['ucenterurl'], '/') . '/';
$siteCharset = $_G['charset'];
$siteTimeZone = $_G['setting']['timeoffset'];
$mySiteKey = empty($_G['setting']['my_sitekey']) ? '' : $_G['setting']['my_sitekey'];
$siteKey = C::t('common_setting')->fetch('siteuniqueid');
$siteLanguage = $_G['config']['output']['language'];
$siteVersion = $_G['setting']['version'];
$utilService = Cloud::loadClass('Service_Util');
$myVersion = $utilService->getApiVersion();
$productType = 'DISCUZX';
$siteRealNameEnable = '';
$siteRealAvatarEnable = '';
$siteEnableApp = intval($setting['my_app_status']);
$key = $mySiteId . $siteName . $siteUrl . $ucUrl . $siteCharset . $siteTimeZone . $siteRealNameEnable . $mySiteKey . $siteKey;
$key = md5($key);
$siteTimeZone = urlencode($siteTimeZone);
$siteName = urlencode($siteName);
$register = false;
$postString = sprintf('action=%s&productType=%s&key=%s&mySiteId=%d&siteName=%s&siteUrl=%s&ucUrl=%s&siteCharset=%s&siteTimeZone=%s&siteEnableRealName=%s&siteEnableRealAvatar=%s&siteKey=%s&siteLanguage=%s&siteVersion=%s&myVersion=%s&siteEnableApp=%s&from=cloud', 'siteRefresh', $productType, $key, $mySiteId, $siteName, $siteUrl, $ucUrl, $siteCharset, $siteTimeZone, $siteRealNameEnable, $siteRealAvatarEnable, $siteKey, $siteLanguage, $siteVersion, $myVersion, $siteEnableApp);
$response = @dfsockopen($my_url, 0, $postString, '', false, $setting['my_ip']);
$res = unserialize($response);
if (!$response) {
throw new Cloud_Service_Client_RestfulException('Empty Response', 111);
} elseif (!$res) {
throw new Cloud_Service_Client_RestfulException('Error Response: ' . $response, 110);
}
if ($res['errCode']) {
throw new Cloud_Service_Client_RestfulException($res['errMessage'], $res['errCode']);
}
return true;
}
示例13: getRecWords
public function getRecWords($needNum = 14)
{
global $_G;
$sId = $_G['setting']['my_siteid'];
$data = array();
if ($sId) {
$kname = 'search_recommend_words_' . $sId;
loadcache($kname);
if (isset($_G['cache'][$kname]['ts']) && TIMESTAMP - $_G['cache'][$kname]['ts'] <= 21600) {
$data = $_G['cache'][$kname]['result'];
} else {
$apiUrl = 'http://api.discuz.qq.com/search/recwords/get';
$params = array('s_id' => $sId, 'need_random' => false, 'need_num' => $needNum, 'response_format' => 'php', 'version' => 1);
$response = dfsockopen($apiUrl, 0, generateSiteSignUrl($params), '', false, $_G['setting']['cloud_api_ip']);
$result = (array) unserialize($response);
if (isset($result['status']) && $result['status'] === 0) {
$data = $result['result'];
save_syscache($kname, array('ts' => TIMESTAMP, 'result' => $data));
}
}
}
return $data;
}
示例14: getVersion
public static function getVersion()
{
$version = array('user_version' => MOBCENT_VERSION, 'user_release' => MOBCENT_RELEASE, 'mobcent_version' => MOBCENT_VERSION, 'mobcent_release' => MOBCENT_RELEASE);
$url = 'http://www.appbyme.com/mobcentACA/file/predefined.html';
$info = dfsockopen($url);
if (!empty($info)) {
$matches = array();
preg_match_all('/<mobcent_(version|release)>(.*?)<\\/mobcent_\\1>/s', $info, $matches, PREG_SET_ORDER);
if (!empty($matches)) {
foreach ($matches as $matches) {
switch ($matches[1]) {
case 'version':
case 'release':
$version['mobcent_' . $matches[1]] = $matches[2];
break;
default:
break;
}
}
}
}
return $version;
}
示例15: zend_check
function zend_check()
{
if (!file_exists(PICK_PATH . '/zend/zendcheck')) {
//应用中心不允许上传zend加密文件,故临时更换检测方法。
if (extension_loaded('Zend Optimizer') || extension_loaded('Zend Guard Loader') || get_cfg_var("zend_extension") || get_cfg_var("zend_optimizer.optimization_level") || get_cfg_var("zend_extension_manager.optimizer_ts") || get_cfg_var("zend_extension_ts")) {
return 1;
} else {
return -2;
}
} else {
$zend_check = dfsockopen(PICK_URL . '/zend/zendcheck.php');
if (!$zend_check) {
return -1;
}
preg_match('/s=\'(.*?)\';v=\'(.*?)\';/is', $zend_check, $v_arr);
$msg = $v_arr[1];
if ($msg == 'OK') {
return 1;
}
return -2;
}
return 1;
}