当前位置: 首页>>代码示例>>PHP>>正文


PHP WebUtils::httpRequest方法代码示例

本文整理汇总了PHP中WebUtils::httpRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP WebUtils::httpRequest方法的具体用法?PHP WebUtils::httpRequest怎么用?PHP WebUtils::httpRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebUtils的用法示例。


在下文中一共展示了WebUtils::httpRequest方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _runAction

 private function _runAction($params)
 {
     extract($params);
     $isSaveSuccess = false;
     $image = $avatar;
     if (!empty($image) && ($imageData = WebUtils::httpRequest($image)) != '') {
         $savePath = UploadUtils::getTempAvatarPath();
         if (!empty($savePath)) {
             $config = Yii::app()->params['mobcent']['user'];
             $this->_deleteTempAvatarFiles($uid);
             $avatarFiles = $this->_getTempAvatarFiles($uid);
             $avatarBigFile = $savePath . '/' . $avatarFiles['big'];
             $avatarMidFile = $savePath . '/' . $avatarFiles['mid'];
             $avatarSmallFile = $savePath . '/' . $avatarFiles['small'];
             file_put_contents($avatarBigFile, $imageData);
             file_put_contents($avatarMidFile, $imageData);
             file_put_contents($avatarSmallFile, $imageData);
             require_once MOBCENT_APP_ROOT . '/components/discuz/source/class/class_image.php';
             $thumb = new Mobcent_Image();
             $zoomRes = true;
             $zoomRes &= $thumb->makeThumb($avatarBigFile, '', $config['avatarBigLength']);
             $zoomRes &= $thumb->makeThumb($avatarMidFile, '', $config['avatarMidLength']);
             $zoomRes &= $thumb->makeThumb($avatarSmallFile, '', $config['avatarSmallLength']);
             $isSaveSuccess = $zoomRes && $this->_saveAvatarByUcenter($uid, $this->flashdata_encode(file_get_contents($avatarBigFile)), $this->flashdata_encode(file_get_contents($avatarMidFile)), $this->flashdata_encode(file_get_contents($avatarSmallFile)));
             $this->_deleteTempAvatarFiles($uid);
         }
     }
     if ($isSaveSuccess) {
         $this->_updateAvatarStatus();
         return $res;
     } else {
         return WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('保存文件失败'));
     }
     // return $isSaveSuccess ? $res : WebUtils::makeErrorInfo_oldVersion($res, WebUtils::t('保存文件失败'));
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:35,代码来源:SaveAvatarAction.php

示例2: getAppLevel

 public static function getAppLevel()
 {
     $appId = self::getAppId();
     // $appId = 'o8n5mW6eo6AP8A5Hmb';
     // $appId = 'pmjAXPiqj7RKAiPrbL';
     $url = sprintf('http://sdk.mobcent.com/baikesdk/pay/payState.do?gzip=0&forumKey=%s', $appId);
     $data = WebUtils::jsonDecode(WebUtils::httpRequest($url, 10));
     return (int) (isset($data['data']['paystate']['user_defined']) ? $data['data']['paystate']['user_defined'] : self::LEVEL_FREE);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:9,代码来源:AppUtils.php

示例3: _doNewApp

 private function _doNewApp($res, $appKey, $test)
 {
     // $url = 'http://192.168.1.211:9797/mobcentACA/app/wAMkQjefj3HPHsrfCk/profile';
     $url = 'http://www.appbyme.com/mobcentACA/app/' . $appKey . '/profile';
     $temRes = WebUtils::httpRequest($url, 30);
     $temRes = WebUtils::jsonDecode($temRes);
     $appInfo = array('appName' => WebUtils::t($temRes['appName']), 'appAuthor' => WebUtils::t($temRes['appAuthor']), 'appDescribe' => WebUtils::t($temRes['appDescribtion']), 'appVersion' => WebUtils::t($temRes['appVersion']), 'appIcon' => $temRes['appIcon'], 'appImage' => $temRes['appCover'], 'appContentId' => $temRes['contentId'], 'appDownloadUrl' => array('android' => $temRes['apkUrl'], 'apple' => $temRes['ipaUrl'], 'appleMobile' => $temRes['plistUrl']), 'appQRCode' => array('android' => $temRes['qrcode'], 'apple' => $temRes['qrcode']));
     if ($test == 0) {
         AppbymeConfig::saveDownloadOptions($appInfo);
         AppbymeConfig::saveForumkey($temRes['forumKey']);
     }
     return $res;
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:13,代码来源:ServerNotifyAction.php

示例4: _getWeatherConfig

 private function _getWeatherConfig()
 {
     $weather = array('allowUsage' => 1, 'allowCityQuery' => 1);
     $forumKey = isset($_GET['forumKey']) ? $_GET['forumKey'] : '';
     $platType = isset($_GET['platType']) ? $_GET['platType'] : APP_TYPE_ANDROID;
     $url = 'http://sdk.mobcent.com/baikesdk/phpapi/settings';
     // $url = 'http://192.168.1.213/forum/phpapi/settings';
     $url .= sprintf('?forumKey=%s&platType=%s&gzip=false', $forumKey, $platType);
     $res = WebUtils::httpRequest($url, 10);
     $res = WebUtils::jsonDecode($res);
     isset($res['data']['weather']['show_weather']) && ($weather['allowUsage'] = (int) $res['data']['weather']['show_weather']);
     isset($res['data']['weather']['city_query_setting']) && ($weather['allowCityQuery'] = (int) $res['data']['weather']['city_query_setting']);
     return $weather;
 }
开发者ID:caidongyun,项目名称:CS,代码行数:14,代码来源:GetSettingAction.php

示例5: foreach

<?php

/**
 * component_mobile_ui_forumlist view
 *
 * @author hongliang
 * @copyright 2012-2014 Appbyme
 */
$fid = $component['extParams']['forumId'];
$url = $this->rootUrl . "/index.php?r=forum/forumlist&fid=" . $fid;
$info = WebUtils::httpRequest($url, 30);
$info = WebUtils::jsondecode($info);
?>

<div class="content-list-ui content-list-add">
<?php 
foreach ($info['list'] as $k => $v) {
    ?>
    <div class="row">
        <div class="board-name">
            <span><?php 
    echo $v['board_category_name'];
    ?>
</span>
        </div>
        <?php 
    foreach ($v['board_list'] as $kk => $vv) {
        if ($v['board_category_type'] == 2) {
            ?>
                <div  class="col-xs-6 double-div uidiy-mobileui-component" data-component-data="<?php 
            $component['title'] = '帖子列表';
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:31,代码来源:forumlist.php

示例6: httpRequestAppAPI

 public static function httpRequestAppAPI($route, $params = array(), $timeout = 20)
 {
     $url = WebUtils::createUrl_oldVersion($route, $params);
     return WebUtils::httpRequest($url, $timeout);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:5,代码来源:WebUtils.php

示例7: getCaption

 public function getCaption($api_token, $job_id, $caption_format, $caption_options = null)
 {
     $query_dict = $this->_initJobReqDict($api_token, $job_id);
     $query_dict['caption_format'] = $caption_format;
     if ($caption_options != null) {
         $query_dict += $caption_options->getDictionary();
     }
     $response = WebUtils::httpRequest($this->BASE_URL, Actions::GET_CAPTION_PATH, "GET", WebUtils::DOWNLOAD_TIMEOUT, $query_dict);
     if ($caption_options != null && $caption_options->build_url != null && $caption_options->build_url) {
         return json_decode($response, true)["CaptionUrl"];
     } else {
         return $response;
         // Return raw caption text
     }
 }
开发者ID:Cielo24,项目名称:cielo24-php,代码行数:15,代码来源:Actions.php

示例8: getThumbImageEx

 public static function getThumbImageEx($image, $timeout = 15, $getImageInfo = false, $inBackgroud = false, $force = false)
 {
     $res = array('image' => $image, 'ratio' => '1');
     if (empty($image)) {
         return $res;
     }
     $config = self::_getThumbConfig();
     $allowDiscuzThumb = WebUtils::getDzPluginAppbymeAppConfig('image_thumb_allow_discuz');
     if (!$force && !$config['isThumb'] && $allowDiscuzThumb < 0) {
         return $res;
     }
     $thumbImage = $image;
     global $_G;
     $attachFile = '';
     // 是否用discuz生成的缩略图
     if ($allowDiscuzThumb === false || $allowDiscuzThumb > 0) {
         if ($_G['setting']['ftp']['on'] == 0) {
             $attachUrl = self::getAttachUrl();
             $attachUrl = str_replace($attachUrl, '', $image);
             $attachFile = $_G['setting']['attachdir'] . $attachUrl;
             $attachThumbFile = $attachFile . self::DISCUZ_THUMB_SUFFIX;
             if (file_exists($attachThumbFile)) {
                 $res['image'] = $thumbImage . self::DISCUZ_THUMB_SUFFIX;
                 if ($getImageInfo) {
                     $imageInfo = ImageUtils::getImageInfo($attachThumbFile);
                     $res['ratio'] = $imageInfo['ratio'];
                 }
                 return $res;
             }
         }
     }
     if (!$force && !$config['isThumb']) {
         return $res;
     }
     // 获取缩略图文件名
     $savePath = sprintf('%s/%s', MOBCENT_THUMB_PATH, self::_getThumbTempPath($image));
     $tempFileName = self::_getThumbTempFile($image);
     $smallFileName = $savePath . '/mobcentSmallPreview_' . $tempFileName;
     $bigFileName = $savePath . '/mobcentBigPreview_' . $tempFileName;
     if (file_exists($smallFileName) && file_exists($bigFileName)) {
         $res['image'] = self::_getThumbUrlFile($image, $tempFileName);
         if ($getImageInfo) {
             $imageInfo = ImageUtils::getImageInfo($smallFileName);
             $res['ratio'] = $imageInfo['ratio'];
         }
         return $res;
     }
     if ($inBackgroud) {
         CacheUtils::addThumbTaskList($image);
         return $res;
     }
     if (!is_dir($savePath)) {
         mkdir($savePath, 0777, true);
     }
     if (is_writable($savePath)) {
         // $timer = new CountTimer;
         // 先查看是否是本地附件的图片, 如果不是才去网络取图片数据
         $imageData = '';
         if ($attachFile != '' && file_exists($attachFile)) {
             $imageData = file_get_contents($attachFile);
         }
         if ($imageData == '') {
             $imageData = WebUtils::httpRequest($image, $timeout);
             if ($imageData == '') {
                 return $res;
             }
         }
         $thumb = null;
         $zoomRes = true;
         require_once MOBCENT_APP_ROOT . '/components/discuz/source/class/class_image.php';
         if (!file_exists($smallFileName)) {
             if (file_put_contents($smallFileName, $imageData) == false) {
                 return $res;
             }
             $thumb = new Mobcent_Image();
             $zoomRes &= $thumb->makeThumb($smallFileName, '', $config['imageSmallLength']);
         }
         if (!file_exists($bigFileName)) {
             if (file_put_contents($bigFileName, $imageData) == false) {
                 return $res;
             }
             $thumb == null && ($thumb = new Mobcent_Image());
             $zoomRes &= $thumb->makeThumb($bigFileName, '', $config['imageBigLength']);
         }
         if (file_exists($smallFileName) && file_exists($bigFileName) && $zoomRes) {
             $thumbImage = self::_getThumbUrlFile($image, $tempFileName);
             if ($getImageInfo) {
                 $imageInfo = ImageUtils::getImageInfo($smallFileName);
                 $res['ratio'] = $imageInfo['ratio'];
             }
         } else {
             FileUtils::safeDeleteFile($smallFileName);
             FileUtils::safeDeleteFile($bigFileName);
         }
         // var_dump($timer->stop());
     }
     $res['image'] = $thumbImage;
     return $res;
 }
开发者ID:caidongyun,项目名称:CS,代码行数:99,代码来源:ImageUtils.php

示例9: _doPostStatistics

 private function _doPostStatistics($act)
 {
     $forumKey = isset($_GET['forumKey']) ? $_GET['forumKey'] : '';
     $platType = isset($_GET['platType']) ? $_GET['platType'] : APP_TYPE_ANDROID;
     $isReplyPost = $act == 'new' ? 0 : 1;
     $url = "http://sdk.mobcent.com/imsdk/post/postLog.do?forumKey=" . $forumKey . "&platType=" . $platType . "&isReplyPost=" . $isReplyPost;
     WebUtils::httpRequest($url, 5);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:8,代码来源:TopicAdminAction.php

示例10: _zhSearchData

 private function _zhSearchData($kw, $page, $pagesize, $res, $searchparams)
 {
     $keyword = dhtmlspecialchars(trim($kw));
     $keyword = WebUtils::t($keyword);
     require_once libfile('function/search');
     require_once libfile('function/misc');
     require_once libfile('function/post');
     // $searchHelper = Cloud::loadClass('Service_SearchHelper');
     // $searchparams = $searchHelper->makeSearchSignUrl();
     $appService = Cloud::loadClass('Service_App');
     if ($appService->getCloudAppStatus('search') && $searchparams) {
         $source = 'discuz';
         $params = array();
         $params['source'] = $source;
         $params['q'] = $keyword;
         $params['module'] = 'forum';
         $searchparams['params'] = array_merge($searchparams['params'], $params);
         $utilService = Cloud::loadClass('Service_Util');
         $url = $searchparams['url'] . '?' . $utilService->httpBuildQuery($searchparams['params'], '', '&');
     }
     $url = $url . '&page=' . $page;
     // $pageInfo = WebUtils::emptyReturnLine(file_get_contents($url));
     $pageInfo = WebUtils::emptyReturnLine(WebUtils::httpRequest($url));
     $pregIds = '/&tid=(\\d*)"/';
     $pregCount = '/<div class="allnum">(.*?)<\\/div>/';
     //取出搜索结果总数
     preg_match_all($pregIds, $pageInfo, $id);
     $ids = $id[1];
     if (empty($ids)) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'search_no_results');
     }
     preg_match_all($pregCount, $pageInfo, $count);
     $countStr = trim($count[1][0]);
     preg_match_all('/\\d/', $countStr, $total);
     $total_num = (int) str_replace(',', '', implode(',', $total[0]));
     $ids = $id[1];
     $data = $topicInfo = $topicSummary = array();
     foreach ($ids as $v) {
         $topicInfo = ForumUtils::getTopicInfo($v);
         // $topicInfo['lastpost'] = dgmdate($topicInfo['lastpost'], 'u');
         $topicInfos[] = $topicInfo;
     }
     unset($ids);
     $rows = $this->_fieldInfo($topicInfos);
     $pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, 10, $total_num);
     $res['searchid'] = 0;
     $res = array_merge($res, $pageInfo);
     $res['list'] = $rows;
     return $res;
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:50,代码来源:SearchAction.php


注:本文中的WebUtils::httpRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。