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


PHP FileHandler::getRemoteResource方法代码示例

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


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

示例1: checkEasyinstall

 /**
  * check easy install
  * @return void
  */
 function checkEasyinstall()
 {
     $lastTime = (int) FileHandler::readFile($this->easyinstallCheckFile);
     if ($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) {
         return;
     }
     $oAutoinstallModel = getModel('autoinstall');
     $params = array();
     $params["act"] = "getResourceapiLastupdate";
     $body = XmlGenerater::generate($params);
     $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
     $xml_lUpdate = new XmlParser();
     $lUpdateDoc = $xml_lUpdate->parse($buff);
     $updateDate = $lUpdateDoc->response->updatedate->body;
     if (!$updateDate) {
         $this->_markingCheckEasyinstall();
         return;
     }
     $item = $oAutoinstallModel->getLatestPackage();
     if (!$item || $item->updatedate < $updateDate) {
         $oController = getAdminController('autoinstall');
         $oController->_updateinfo();
     }
     $this->_markingCheckEasyinstall();
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:29,代码来源:admin.admin.view.php

示例2: getXmlDoc

 /**
  * Request data to server and returns result
  *
  * @param array $params Request data
  * @return object
  */
 function getXmlDoc(&$params)
 {
     $body = XmlGenerater::generate($params);
     $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
     if (!$buff) {
         return;
     }
     $xml = new XmlParser();
     $xmlDoc = $xml->parse($buff);
     return $xmlDoc;
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:17,代码来源:autoinstall.class.php

示例3: emitEvent

 function emitEvent($args = array())
 {
     $oAjaxboardModel = getModel('ajaxboard');
     $module_config = $oAjaxboardModel->getConfig();
     $fields = array_merge($args, array('token' => $module_config->token, 'private_key' => $module_config->private_key));
     $request_config = array('ssl_verify_peer' => false);
     $request_url = $module_config->server_url;
     $timeout = $module_config->timeout / 1000;
     $buff = FileHandler::getRemoteResource($request_url, NULL, $timeout, 'POST', 'application/x-www-form-urlencoded', array(), array(), $fields, $request_config);
     return $buff;
 }
开发者ID:swhite523,项目名称:ajaxboard,代码行数:11,代码来源:ajaxboard.controller.php

示例4: getXmlDoc

 /**
  * Request data to server and returns result
  *
  * @param array $params Request data
  * @return object
  */
 function getXmlDoc(&$params)
 {
     $body = XmlGenerater::generate($params);
     $request_config = array('ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE);
     $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
     if (!$buff) {
         return;
     }
     $xml = new XmlParser();
     $xmlDoc = $xml->parse($buff);
     return $xmlDoc;
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:18,代码来源:autoinstall.class.php

示例5: _getContent

 function _getContent($method, $user_id = null, $params = null)
 {
     $url = $this->api_url . $this->_getPath($method, $user_id);
     $auth = base64_encode($this->user_id . ':' . $this->_getAuthKey());
     $arr_content = array();
     if (is_array($params) && count($params)) {
         foreach ($params as $key => $val) {
             $arr_content[] = sprintf('%s=%s', $key, urlencode($val));
         }
         $body = implode('&', $arr_content);
     }
     $buff = FileHandler::getRemoteResource($url, $body, 3, 'GET', 'application/x-www-form-urlencoded', array('me2_application_key' => $this->application_key, 'Authorization' => 'Basic ' . $auth));
     return $buff;
 }
开发者ID:google-code-backups,项目名称:xe-textyle,代码行数:14,代码来源:me2day.api.php

示例6: _updateinfo

 /**
  * Update easy install information
  *
  * @return void
  */
 function _updateinfo()
 {
     $oModel =& getModel('autoinstall');
     $item = $oModel->getLatestPackage();
     if ($item) {
         $params["updatedate"] = $item->updatedate;
     }
     $params["act"] = "getResourceapiUpdate";
     $body = XmlGenerater::generate($params);
     $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
     $xml = new XmlParser();
     $xmlDoc = $xml->parse($buff);
     $this->updateCategory($xmlDoc);
     $this->updatePackages($xmlDoc);
     $this->checkInstalled();
 }
开发者ID:relip,项目名称:xe-core,代码行数:21,代码来源:autoinstall.admin.controller.php

示例7: _updateinfo

 /**
  * Update easy install information
  *
  * @return void
  */
 function _updateinfo()
 {
     $oModel = getModel('autoinstall');
     $item = $oModel->getLatestPackage();
     if ($item) {
         $params["updatedate"] = $item->updatedate;
     }
     $params["act"] = "getResourceapiUpdate";
     $body = XmlGenerater::generate($params);
     $request_config = array('ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE);
     $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
     $xml = new XmlParser();
     $xmlDoc = $xml->parse($buff);
     $this->updateCategory($xmlDoc);
     $this->updatePackages($xmlDoc);
     $this->checkInstalled();
     $oAdminController = getAdminController('admin');
     $output = $oAdminController->cleanFavorite();
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:24,代码来源:autoinstall.admin.controller.php

示例8: _send

 /**
  * @brief 대상 사이트에 요청을 보냄
  * @deprecated
  */
 private function _send($type, $target_domain, $params = array(), $timeout = 30)
 {
     if (!in_array($type, $this->api_methods)) {
         throw new Exception('Invalid Method');
         return NULL;
     }
     // 기본적으로 전송되어야 할 json data
     $params['module'] = 'alliance';
     $params['act'] = 'procAllianceAPI';
     $params['type'] = $type;
     $params['domain'] = $this->current_url;
     foreach ($params as $key => $val) {
         $param[] = $key . '=' . $val;
     }
     $params_str = implode('&', $param);
     $header['User-Agent'] = AXE_USER_AGENT;
     $url = $this->arrangeDomain($target_domain);
     // XE에 내장된 FileHandler::getRemoteResource()를 이용함
     return FileHandler::getRemoteResource($url, $params_str, $timeout, 'POST', AXE_CONTENT_TYPE, $header);
 }
开发者ID:haegyung,项目名称:alliancexe,代码行数:24,代码来源:alliance.controller.api.php

示例9: soo_search

 function soo_search()
 {
     $soo_display_set = trim($this->soo_display);
     $q_sort = urlencode(trim(Context::get('q_sort')));
     $query = urlencode(trim(Context::get('query')));
     $soo_result_start = urlencode(Context::get('soo_result_start'));
     if (!$soo_display_set) {
         $soo_display_set = '20';
     }
     if (!$soo_result_start) {
         $soo_result_start = '1';
     }
     $uri = sprintf('http://gdata.youtube.com/feeds/api/videos?q=%s&start-index=%s&max-results=%s&orderby=%s&v=2&alt=rss', $query, $soo_result_start, $soo_display_set, $q_sort);
     $rss = '';
     $rss = FileHandler::getRemoteResource($uri, null, 3, 'GET', 'application/xml');
     $rss = preg_replace("/<\\?xml([.^>]*)\\?>/i", "", $rss);
     $oXmlParser = new XmlParser();
     $xml_doc = $oXmlParser->parse($rss);
     $error_code = trim($xml_doc->errors->error->code->body);
     $error_message = trim($xml_doc->errors->error->internalreason->body);
     if ($error_message) {
         return new Object(-1, '::Youtube API Error::' . "\n" . $error_code . "\n" . $error_message);
     }
     $total_result_no = trim($xml_doc->rss->channel->{'opensearch:totalresults'}->body);
     $soo_result_start = trim($xml_doc->rss->channel->{'opensearch:startindex'}->body);
     $soo_search_display = trim($xml_doc->rss->channel->{'opensearch:itemsperpage'}->body);
     if ($total_result_no >= $soo_result_start + $soo_search_display) {
         $soo_next_page = $soo_result_start + $soo_display_set;
     } else {
         $soo_next_page = "1";
     }
     if ($soo_result_start != '1') {
         $soo_before_page = $soo_result_start - $soo_display_set;
     } else {
         $soo_before_page = "1";
     }
     $soo_results = $xml_doc->rss->channel->item;
     if (!is_array($soo_results)) {
         $soo_results = array($soo_results);
     }
     $soo_results_count = count($soo_results);
     $soo_result_start_end = trim($soo_result_start . ' - ' . ($soo_result_start + $soo_results_count - 1));
     $soo_list = array();
     for ($i = 0; $i < $soo_results_count; $i++) {
         $item = $soo_results[$i];
         $item_images = $item->{'media:group'}->{'media:thumbnail'};
         if (!is_array($item_images)) {
             $item_images = array($item_images);
         }
         $item_published = explode('T', $item->{'media:group'}->{'yt:uploaded'}->body);
         $item_updated = explode('T', $item->{'atom:updated'}->body);
         $item_second = $item->{'media:group'}->{'yt:duration'}->attrs->seconds % 60;
         $item_minute = intval($item->{'media:group'}->{'yt:duration'}->attrs->seconds / 60) % 60;
         $item_hour = intval(intval($item->{'media:group'}->{'yt:duration'}->attrs->seconds / 60) / 60);
         if (!is_array($item->{'media:group'}->{'media:content'})) {
             $item->{'media:group'}->{'media:content'} = array($item->{'media:group'}->{'media:content'});
         }
         $soo_list[] = sprintf("%s,[[soo]],%s,[[soo]],%s,[[soo]],%s,[[soo]],%s,[[soo]],%s,[[soo]],%s,[[soo]],%s,[[soo]],%s,[[soo]],%s,[[soo]],%s,[[soo]],%s", trim($item->title->body), trim($item->author->body), trim($item->{'media:group'}->{'media:content'}[0]->attrs->url), trim($item_images[1]->attrs->url), trim($item_published[0]), trim($item_updated[0]), trim($item_hour), trim($item_minute), trim($item_second), trim($item->{'yt:statistics'}->attrs->viewcount), trim($item->link->body), cut_str(trim($item->title->body), 20));
     }
     $this->add("total_result_no", $total_result_no);
     $this->add("total", htmlspecialchars($rss));
     $this->add("soo_result_start", $soo_result_start);
     $this->add("soo_result_start_end", $soo_result_start_end);
     $this->add("result_list_bfpage", $soo_before_page);
     $this->add("result_list_nextpage", $soo_next_page);
     $this->add("result_list", implode("\n", $soo_list));
 }
开发者ID:noxowl,项目名称:Yojouhankai-Sketchbook5,代码行数:67,代码来源:multimedia.class.php

示例10: getRemoteResource

 function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array())
 {
     requirePear();
     require_once 'HTTP/Request.php';
     $parsed_url = parse_url(__PROXY_SERVER__);
     if ($parsed_url["host"]) {
         $oRequest = new HTTP_Request(__PROXY_SERVER__);
         $oRequest->setMethod('POST');
         $oRequest->_timeout = $timeout;
         $oRequest->addPostData('arg', serialize(array('Destination' => $url, 'method' => $method, 'body' => $body, 'content_type' => $content_type, "headers" => $headers, "post_data" => $post_data)));
     } else {
         $oRequest = new HTTP_Request($url);
         if (count($headers)) {
             foreach ($headers as $key => $val) {
                 $oRequest->addHeader($key, $val);
             }
         }
         if ($cookies[$host]) {
             foreach ($cookies[$host] as $key => $val) {
                 $oRequest->addCookie($key, $val);
             }
         }
         if (count($post_data)) {
             foreach ($post_data as $key => $val) {
                 $oRequest->addPostData($key, $val);
             }
         }
         if (!$content_type) {
             $oRequest->addHeader('Content-Type', 'text/html');
         } else {
             $oRequest->addHeader('Content-Type', $content_type);
         }
         $oRequest->setMethod($method);
         if ($body) {
             $oRequest->setBody($body);
         }
         $oRequest->_timeout = $timeout;
     }
     $oResponse = $oRequest->sendRequest();
     $code = $oRequest->getResponseCode();
     $header = $oRequest->getResponseHeader();
     $response = $oRequest->getResponseBody();
     if ($c = $oRequest->getResponseCookies()) {
         foreach ($c as $k => $v) {
             $cookies[$host][$v['name']] = $v['value'];
         }
     }
     if ($code > 300 && $code < 399 && $header['location']) {
         return FileHandler::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
     }
     return $response;
 }
开发者ID:leehankyeol,项目名称:module-server,代码行数:52,代码来源:me2day.php

示例11: getSyndicationStatusNaver

 function getSyndicationStatusNaver($site_url)
 {
     $status_url = trim($this->statuses['Naver']);
     $xml = FileHandler::getRemoteResource(sprintf($status_url, $site_url), null, 3, 'GET', 'application/xml');
     $oXmlParser = new XmlParser();
     $oXml = $oXmlParser->parse($xml);
     $oStatus = $oXml->syndication_status;
     if ($oStatus->error->body != 0) {
         return new Object(-1, $oStatus->message->body);
     }
     $result = new stdClass();
     $result->site_name = $oStatus->site_name->body;
     $result->first_update = $oStatus->first_update->body;
     $result->last_update = $oStatus->last_update->body;
     $result->visit_ok_count = $oStatus->visit_ok_count->body;
     $result->visit_fail_count = $oStatus->visit_fail_count->body;
     $result->status = $oStatus->status->body;
     if (!$oStatus->sync || !$oStatus->sync->article) {
         $oArticleList = array();
     } else {
         $oArticleList = $oStatus->sync->article;
         if (!is_array($oArticleList)) {
             $oArticleList = array($oArticleList);
         }
     }
     if (count($oArticleList) > 0) {
         $article_count = array();
         foreach ($oArticleList as $article) {
             $article_count[$article->attrs->date] = $article->body;
         }
         $result->article_count = $article_count;
         $result->max_article_count = max($result->article_count);
     }
     Context::set('result', $result);
     $oTemplateHandler =& TemplateHandler::getInstance();
     $html = $oTemplateHandler->compile($this->module_path . 'tpl', 'naver_result');
     $output = new Object();
     $output->add('result_status', $html);
     return $output;
 }
开发者ID:JeonJonguk,项目名称:Pull-Request-Test,代码行数:40,代码来源:syndication.admin.controller.php

示例12: getRemoteFile

 /**
  * @brief 원격파일을 다운받아서 특정 위치에 저장
  **/
 function getRemoteFile($url, $target_filename, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array())
 {
     $body = FileHandler::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers);
     if (!$body) {
         return;
     }
     $target_filename = FileHandler::getRealPath($target_filename);
     FileHandler::writeFile($target_filename, $body);
     return true;
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:13,代码来源:FileHandler.class.php

示例13: httpRequest

 function httpRequest($url, $mode = 'GET')
 {
     if ($mode == 'POST') {
         $url_info = parse_url($url);
         $url = $url_info['scheme'] . '://' . $url_info['host'];
         if (!$url_info['port'] || $url_info['port'] == '80') {
             $url .= $url_info['path'];
         } else {
             $url .= ':' . $url_info['port'] . $url_info['path'];
         }
         $body = $url_info['query'];
     }
     $headers = array('User-Agent' => "SocialXE ClientBot Ver. {$this->version}");
     $output = FileHandler::getRemoteResource($url, $body, 30, $mode, 'application/json', $headers);
     return $output;
 }
开发者ID:leehankyeol,项目名称:JaWeTip,代码行数:16,代码来源:communicator.php

示例14: getAdminFTPPath

 /**
  * Find XE installed path on ftp
  */
 function getAdminFTPPath()
 {
     Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
     @set_time_limit(5);
     $ftp_info = Context::getRequestVars();
     if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
         return new Object(1, 'msg_ftp_invalid_auth_info');
     }
     if (!$ftp_info->ftp_host) {
         $ftp_info->ftp_host = '127.0.0.1';
     }
     if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) {
         $ftp_info->ftp_port = '21';
     }
     if ($ftp_info->sftp == 'Y') {
         if (!function_exists('ssh2_sftp')) {
             return new Object(-1, 'disable_sftp_support');
         }
         return $this->getSFTPPath();
     }
     if ($ftp_info->ftp_pasv == 'N') {
         if (function_exists('ftp_connect')) {
             return $this->getFTPPath();
         }
         $ftp_info->ftp_pasv = "Y";
     }
     $oFTP = new ftp();
     if (!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
         return new Object(1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
     }
     if (!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
         return new Object(1, 'msg_ftp_invalid_auth_info');
     }
     // create temp file
     $pin = $_SERVER['REQUEST_TIME'];
     FileHandler::writeFile('./files/cache/ftp_check', $pin);
     // create path candidate
     $xe_path = _XE_PATH_;
     $path_info = array_reverse(explode('/', _XE_PATH_));
     array_pop($path_info);
     // remove last '/'
     $path_candidate = array();
     $temp = '';
     foreach ($path_info as $path) {
         $temp = '/' . $path . $temp;
         $path_candidate[] = $temp;
     }
     // try
     foreach ($path_candidate as $path) {
         // upload check file
         if (!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) {
             continue;
         }
         // get check file
         $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
         // delete temp check file
         $oFTP->ftp_delete($path . 'ftp_check.html');
         // found
         if ($result == $pin) {
             $found_path = $path;
             break;
         }
     }
     FileHandler::removeFile('./files/cache/ftp_check', $pin);
     if ($found_path) {
         $this->add('found_path', $found_path);
     }
 }
开发者ID:conory,项目名称:rhymix,代码行数:71,代码来源:admin.admin.model.php

示例15: dispAutoinstallAdminUninstall

 /**
  * Display uninstall package
  *
  * @return Object
  */
 function dispAutoinstallAdminUninstall()
 {
     $package_srl = Context::get('package_srl');
     if (!$package_srl) {
         return $this->dispAutoinstallAdminIndex();
     }
     $oModel =& getModel('autoinstall');
     $installedPackage = $oModel->getInstalledPackage($package_srl);
     if (!$installedPackage) {
         return $this->dispAutoinstallAdminInstalledPackages();
     }
     if (!$_SESSION['ftp_password']) {
         Context::set('need_password', true);
     }
     $installedPackage = $oModel->getPackage($package_srl);
     $path = $installedPackage->path;
     $type = $oModel->getTypeFromPath($path);
     if (!$type || $type == "core") {
         return $this->stop("msg_invalid_request");
     }
     $config_file = $oModel->getConfigFilePath($type);
     if (!$config_file) {
         return $this->stop("msg_invalid_request");
     }
     $params["act"] = "getResourceapiPackages";
     $params["package_srls"] = $package_srl;
     $body = XmlGenerater::generate($params);
     $buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
     $xml_lUpdate = new XmlParser();
     $xmlDoc = $xml_lUpdate->parse($buff);
     if ($xmlDoc && $xmlDoc->response->packagelist->item) {
         $item_list = $this->rearranges($xmlDoc->response->packagelist->item);
         $installedPackage->title = $item_list[$package_srl]->title;
         $installedPackage->type = $item_list[$package_srl]->category;
         $installedPackage->avail_remove = $item_list[$package_srl]->avail_remove;
         $installedPackage->deps = $item_list[$package_srl]->deps;
         Context::set('package', $installedPackage);
         $this->setTemplateFile('uninstall');
         Context::addJsFilter($this->module_path . 'tpl/filter', 'uninstall_package.xml');
         $security = new Security();
         $security->encodeHTML('package.');
         $this->setTemplateFile('uninstall');
     } else {
         return $this->stop('msg_connection_fail');
     }
 }
开发者ID:relip,项目名称:xe-core,代码行数:51,代码来源:autoinstall.admin.view.php


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