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


PHP eZHTTPTool::getDataByURL方法代码示例

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


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

示例1: get

 function get($oid)
 {
     $oidroot = $this->oidRoot();
     $oidroot = $oidroot[0];
     switch (preg_replace('/\\.0$/', '', $oid)) {
         case $oidroot . '1.1':
             if (in_array('ezfind', eZExtension::activeExtensions())) {
                 $ini = eZINI::instance('solr.ini');
                 $data = eZHTTPTool::getDataByURL($ini->variable('SolrBase', 'SearchServerURI') . "/admin/ping", false);
                 if (stripos($data, '<str name="status">OK</str>') !== false) {
                     $status = 1;
                 } else {
                     $status = 0;
                 }
             } else {
                 $status = -1;
             }
             return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $status);
         case $oidroot . '1.2':
             if (in_array('ezfind', eZExtension::activeExtensions())) {
                 $ini = eZINI::instance('solr.ini');
                 $data = eZHTTPTool::getDataByURL($ini->variable('SolrBase', 'SearchServerURI') . "/admin/stats.jsp", false);
                 if (preg_match('#<stat +name="numDocs" +>[ \\t\\r\\n]*(\\d+)[ \\t\\r\\n]*</stat>#', $data, $status)) {
                     $status = $status[1];
                 } else {
                     $status = -2;
                 }
             } else {
                 $status = -1;
             }
             return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $status);
     }
     return self::NO_SUCH_OID;
 }
开发者ID:gggeek,项目名称:ezsnmpd,代码行数:34,代码来源:ezsnmpdezfindhandler.php

示例2: gather

 static function gather()
 {
     $contentTypes = array('Objects (including users)' => array('table' => 'ezcontentobject'), 'Users' => array('table' => 'ezuser'), 'Nodes' => array('table' => 'ezcontentobject_tree'), 'Content Classes' => array('table' => 'ezcontentclass'), 'Information Collections' => array('table' => 'ezinfocollection'), 'Pending notification events' => array('table' => 'eznotificationevent', 'wherecondition' => 'status = 0'), 'Objects pending indexation' => array('table' => 'ezpending_actions', 'wherecondition' => "action = 'index_object'"), 'Binary files (content)' => array('table' => 'ezbinaryfile'), 'Image files (content)' => array('table' => 'ezimagefile'), 'Media files (content)' => array('table' => 'ezmedia'), 'Maximum children per node' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_tree GROUP BY parent_node_id ) nodes'), 'Maximum nodes per object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_tree GROUP BY contentobject_id ) nodes'), 'Maximum incoming relations to an object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_link GROUP BY to_contentobject_id ) links', 'nvl' => 0), 'Maximum outgoing relations from an object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_link GROUP BY from_contentobject_id ) links', 'nvl' => 0));
     $db = eZDB::instance();
     $contentList = array();
     foreach ($contentTypes as $key => $desc) {
         if (isset($desc['table'])) {
             $sql = 'SELECT COUNT(*) AS NUM FROM ' . $desc['table'];
             if (@$desc['wherecondition']) {
                 $sql .= ' WHERE ' . $desc['wherecondition'];
             }
         } else {
             $sql = $desc['sql'];
         }
         $count = $db->arrayQuery($sql);
         $contentList[$key] = $count[0]['NUM'] === null ? $desc['nvl'] : $count[0]['NUM'];
     }
     if (in_array('ezfind', eZExtension::activeExtensions())) {
         $ini = eZINI::instance('solr.ini');
         $ezfindpingurl = $ini->variable('SolrBase', 'SearchServerURI') . "/admin/stats.jsp";
         $data = eZHTTPTool::getDataByURL($ezfindpingurl, false);
         //var_dump( $data );
         if (preg_match('#<stat +name="numDocs" ?>([^<]+)</stat>#', $data, $matches)) {
             $contentList['Documents in SOLR'] = trim($matches[1]);
         } else {
             $contentList['Documents in SOLR'] = 'Unknown';
         }
     }
     return $contentList;
 }
开发者ID:gggeek,项目名称:ggsysinfo,代码行数:30,代码来源:contentstatsgatherer.php

示例3: acquireToken

    /**
     * @return string
     */
    protected function acquireToken()
    {
        $response = eZHTTPTool::getDataByURL($this->tokenAcquireApiUrl);
        $xml = simplexml_load_string($response);

        return (string)$xml->data->string;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:10,代码来源:externallinkhandlermedienspiegel.php

示例4: getMediaRecent

 public function getMediaRecent($pageID = false, $limit = 20)
 {
     $result = array('result' => array());
     $accumulator = $this->debugAccumulatorGroup . '_instagram_media_recent';
     eZDebug::accumulatorStart($accumulator, $this->debugAccumulatorGroup, 'media_recent');
     $cacheFileHandler = $this->getCacheFileHandler('_media_recent', array($pageID, $limit));
     try {
         if ($this->isCacheExpired($cacheFileHandler)) {
             eZDebug::writeDebug(array('page_id' => $pageID, 'limit' => $limit), self::$debugMessagesGroup);
             $items = array();
             $userData = eZHTTPTool::getDataByURL('https://api.instagram.com/v1/users/search?' . 'q=' . $pageID . '&' . 'client_id=' . $this->API['key']);
             $userID = false;
             if ($userData !== false) {
                 $userDataArray = json_decode($userData, true);
                 if (count($userDataArray['data'])) {
                     foreach ($userDataArray['data'] as $user) {
                         if ($user['username'] == $pageID) {
                             $userID = $user['id'];
                             break;
                         }
                     }
                 }
             }
             if ($userID !== false) {
                 $leftLimit = $limit;
                 $feedData = eZHTTPTool::getDataByURL('https://api.instagram.com/v1/users/' . $userID . '/media/recent/?' . 'access_token=' . $this->API['token']);
                 if ($feedData !== false) {
                     $feedDataArray = json_decode($feedData, true);
                     if (isset($feedDataArray['data'])) {
                         $items = array_merge($items, array_slice($feedDataArray['data'], 0, $leftLimit));
                         $leftLimit = $leftLimit - count($feedDataArray['data']);
                     }
                     $endlessLoopBreaker = 0;
                     while ($endlessLoopBreaker < 50 && $leftLimit > 0 && isset($feedDataArray['pagination']['next_url'])) {
                         $endlessLoopBreaker++;
                         $feedData = eZHTTPTool::getDataByURL($feedDataArray['pagination']['next_url']);
                         if ($feedData !== false) {
                             $feedDataArray = json_decode($feedData, true);
                             $items = array_merge($items, array_slice($feedDataArray['data'], 0, $leftLimit));
                         }
                         $leftLimit = $leftLimit - count($feedDataArray['data']);
                     }
                 }
             }
             $cacheFileHandler->fileStoreContents($cacheFileHandler->filePath, serialize($items));
         } else {
             $items = unserialize($cacheFileHandler->fetchContents());
         }
         eZDebug::accumulatorStop($accumulator);
         $result['result'] = $items;
         return $result;
     } catch (Exception $e) {
         eZDebug::accumulatorStop($accumulator);
         eZDebug::writeError($e->getMessage(), self::$debugMessagesGroup);
         return $result;
     }
 }
开发者ID:sdaoudi,项目名称:nxc_social_networks,代码行数:57,代码来源:instagram.php

示例5: getDataByURL

 public static function getDataByURL($url, array $aCurlParams = array(), $justCheckURL = false, $userAgent = false)
 {
     if (in_array(CURLOPT_RETURNTRANSFER, $aCurlParams) && isset($aCurlParams[CURLOPT_RETURNTRANSFER]) && !$aCurlParams[CURLOPT_RETURNTRANSFER]) {
         $justCheckURL = true;
     } else {
         $aCurlParams[CURLOPT_RETURNTRANSFER] = true;
     }
     if (!extension_loaded('curl') || !count($aCurlParams)) {
         return eZHTTPTool::getDataByURL($url, $justCheckURL, $userAgent);
     }
     $ch = curl_init($url);
     if ($justCheckURL) {
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
         curl_setopt($ch, CURLOPT_TIMEOUT, 15);
         curl_setopt($ch, CURLOPT_FAILONERROR, 1);
         curl_setopt($ch, CURLOPT_NOBODY, 1);
     }
     if ($userAgent) {
         curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
     }
     $ini = eZINI::instance();
     $proxy = $ini->hasVariable('ProxySettings', 'ProxyServer') ? $ini->variable('ProxySettings', 'ProxyServer') : false;
     // If we should use proxy
     if ($proxy) {
         curl_setopt($ch, CURLOPT_PROXY, $proxy);
         $userName = $ini->hasVariable('ProxySettings', 'User') ? $ini->variable('ProxySettings', 'User') : false;
         $password = $ini->hasVariable('ProxySettings', 'Password') ? $ini->variable('ProxySettings', 'Password') : false;
         if ($userName) {
             curl_setopt($ch, CURLOPT_PROXYUSERPWD, "{$userName}:{$password}");
         }
     }
     foreach ($aCurlParams as $iCurlOption => $mCurlParam) {
         curl_setopt($ch, $iCurlOption, $mCurlParam);
     }
     // If we should check url without downloading data from it.
     if ($justCheckURL) {
         if (!curl_exec($ch)) {
             curl_close($ch);
             return false;
         }
         curl_close($ch);
         return true;
     }
     // Getting data
     // ob_start();
     $data = curl_exec($ch);
     $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     if ($responseCode != 200 || !$data) {
         curl_close($ch);
         //   ob_end_clean();
         return false;
     }
     curl_close($ch);
     // $data = ob_get_contents();
     // ob_end_clean();
     return $data;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:57,代码来源:laHttpTool.php

示例6: testGetDataByURL

 /**
  * @dataProvider providerTestGetDataByURL
  */
 public function testGetDataByURL($expectedDataResult, $url, $justCheckURL = false, $userAgent = false)
 {
     $this->assertEquals(eZHTTPTool::getDataByURL($url, $justCheckURL, $userAgent), $expectedDataResult);
     // There's no way to test the whole method without refactoring it.
     if (extension_loaded('curl')) {
         $this->markTestIncomplete('cURL behaviour tested, not fopen()');
     } else {
         $this->markTestIncomplete('fopen() behaviour tested, not cURL');
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:13,代码来源:ezhttptool_test.php

示例7: initialize

 /**
  * (non-PHPdoc)
  * @see extension/sqliimport/classes/sourcehandlers/ISQLIImportHandler::initialize()
  */
 public function initialize()
 {
     $xmlUrl = $this->handlerConfArray['XMLStream'];
     $xmlString = eZHTTPTool::getDataByURL($xmlUrl);
     $xmlOptions = new SQLIXMLOptions(array('xml_string' => $xmlString, 'xml_parser' => 'simplexml'));
     $xmlParser = new SQLIXMLParser($xmlOptions);
     // On recherche tous les products dans la catégorie HardRock/Metal (HAR)
     $fullXML = $xmlParser->parse();
     $fullXML->registerXPathNamespace('x', $this->handlerConfArray['XMLNS']);
     $XPath = "//x:product[contains(./x:merchantCategory, '" . $this->handlerConfArray['MerchantCategory'] . "')]";
     $this->dataSource = $fullXML->xpath($XPath);
 }
开发者ID:obenyoussef,项目名称:metalfrance,代码行数:16,代码来源:mffrancebillet.php

示例8: _retrieveCurrentValue

 function _retrieveCurrentValue()
 {
     $this->current_value = PHP_VERSION;
     $url = 'http://php.net/releases/?serialize=1&version=5';
     try {
         $latestVersion = eZHTTPTool::getDataByURL($url);
         $versionInfo = unserialize($latestVersion);
         $this->recommended_value = $versionInfo['version'];
     } catch (Exception $e) {
         $this->recommended_value = '';
     }
 }
开发者ID:gggeek,项目名称:ggsysinfo,代码行数:12,代码来源:php_version.php

示例9: instanceRepository

 /**
  * @param int $repositoryID
  *
  * @return OCRepositoryClientInterface|OCClassSearchTemplate
  * @throws Exception
  */
 public static function instanceRepository($repositoryID)
 {
     $definition = self::isAvailableRepository($repositoryID);
     if (!$definition) {
         throw new Exception("Non trovo il repository {$repositoryID}");
     }
     $serverInfoUrl = rtrim($definition['Url'], '/') . self::SERVER_BASE_PATH . $repositoryID;
     $definition['ServerBaseUrl'] = $serverInfoUrl;
     $definition['ClientBasePath'] = self::CLIENT_BASE_PATH . $repositoryID;
     if (!eZHTTPTool::getDataByURL($serverInfoUrl, true)) {
         throw new Exception("Repository {$repositoryID} ({$serverInfoUrl}) non raggiungibile");
     }
     $serverInfo = json_decode(eZHTTPTool::getDataByURL($serverInfoUrl), true);
     if (!$serverInfo) {
         throw new Exception("Il repository {$repositoryID} non ha risposto correttamente alla richiesta di informazioni");
     }
     if (isset($serverInfo['error'])) {
         throw new Exception("Errore del server remoto: \" {$serverInfo['error']} \" ");
     }
     if ($serverInfo['type']) {
         if (isset($definition['Handler'])) {
             $clientHandlerName = $definition['Handler'];
         } else {
             $clientHandlerName = 'OCRepository' . $serverInfo['type'] . 'Client';
         }
         if (class_exists($clientHandlerName)) {
             $clientHandler = new $clientHandlerName();
             if (!$clientHandler instanceof OCRepositoryClientInterface) {
                 throw new Exception("La libreria {$clientHandlerName} non estende l'interfaccia corretta");
             }
             $parameters = array();
             if ($serverInfo['parameters']) {
                 $parameters = $serverInfo['parameters'];
             }
             $parameters['definition'] = $definition;
             $clientHandler->init($parameters);
             return $clientHandler;
         }
     }
     throw new Exception("Errore");
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:47,代码来源:occrosssearch.php

示例10: gmapStaticImageGetData

 protected static function gmapStaticImageGetData($args)
 {
     extract($args);
     $markers = array();
     $query = array();
     foreach ($parameters as $key => $value) {
         if (is_array($value)) {
             foreach ($value as $markerProperties) {
                 $latLngArray = array();
                 $markerQuery = array();
                 $markerPositions = array();
                 foreach ($markerProperties as $markerPropertyKey => $markerPropertyValue) {
                     if ($markerPropertyKey == '_positions') {
                         foreach ($markerPropertyValue as $position) {
                             if ($position['lat'] > 0 && $position['lng'] > 0) {
                                 $markerPositions[] = "{$position['lat']},{$position['lng']}";
                             }
                         }
                     } else {
                         $markerQuery[] = "{$markerPropertyKey}:{$markerPropertyValue}";
                     }
                 }
                 if (empty($markerPositions)) {
                     throw new Exception("Positions not found in parameters " . var_export($parameters, 1));
                 } else {
                     //markers=color:blue|46.067618,11.117315
                     $query[] = "markers=" . implode('|', $markerQuery) . '|' . implode('|', $markerPositions);
                 }
             }
         } else {
             //zoom=13 size=600x300 maptype=roadmap
             $query[] = "{$key}={$value}";
         }
     }
     $stringQuery = implode('&', $query);
     $baseUrl = 'http://maps.googleapis.com/maps/api/staticmap';
     $url = "{$baseUrl}?{$stringQuery}";
     $data = eZHTTPTool::getDataByURL($url);
     eZDebug::writeNotice("Generate static map for attribute {$attribute->attribute('id')}: {$url}", __METHOD__);
     return 'data:image/PNG;base64,' . base64_encode($data);
 }
开发者ID:OpencontentCoop,项目名称:ocoperatorscollection,代码行数:41,代码来源:ocoperatorscollectionstools.php

示例11: _recaptcha_http_post

/**
 * Submits an HTTP POST to a reCAPTCHA server
 * @param string $host
 * @param string $path
 * @param array $data
 * @param int port
 * @return array response
 */
function _recaptcha_http_post($host, $path, $data, $port = 80)
{
    $req = _recaptcha_qsencode($data);
    $response = eZHTTPTool::getDataByURL($host . $path . '?' . $req, false, 'reCAPTCHA/PHP');
    return $response;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:14,代码来源:recaptchalib.php

示例12: getRSSVersion

 static function getRSSVersion($url)
 {
     $xmlData = eZHTTPTool::getDataByURL($url);
     if ($xmlData === false) {
         return false;
     }
     // Create DomDocument from http data
     $domDocument = new DOMDocument('1.0', 'utf-8');
     $success = $domDocument->loadXML($xmlData);
     if (!$success) {
         return false;
     }
     $root = $domDocument->documentElement;
     switch ($root->getAttribute('version')) {
         default:
         case '1.0':
             return '1.0';
             break;
         case '0.91':
         case '0.92':
         case '2.0':
             return $root->getAttribute('version');
             break;
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:25,代码来源:ezrssimport.php

示例13: array

 $deleteParams = array();
 $markInvalidParams = array();
 $fileContentCache = array();
 $rows = $db->arrayQuery("SELECT DISTINCT param FROM ezpending_actions WHERE action = 'static_store'", array('limit' => $limit, 'offset' => $offset));
 if (!$rows || empty($rows)) {
     break;
 }
 foreach ($rows as $row) {
     $param = $row['param'];
     $paramList = explode(',', $param);
     $source = $paramList[1];
     $destination = $paramList[0];
     $invalid = isset($paramList[2]) ? $paramList[2] : null;
     if (!isset($fileContentCache[$source])) {
         $cli->output("Fetching URL: {$source}");
         $fileContentCache[$source] = eZHTTPTool::getDataByURL($source, false, eZStaticCache::USER_AGENT);
     }
     if ($fileContentCache[$source] === false) {
         $cli->error("Could not grab content from \"{$source}\", is the hostname correct and Apache running?");
         if ($invalid !== null) {
             $deleteParams[] = $param;
             continue;
         }
         $markInvalidParams[] = $param;
     } else {
         eZStaticCache::storeCachedFile($destination, $fileContentCache[$source]);
         $deleteParams[] = $param;
     }
 }
 if (!empty($markInvalidParams)) {
     $db->begin();
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:staticcache_cleanup.php

示例14: executeActions

    /**
     * This function goes over the list of recorded actions and excecutes them.
     */
    static function executeActions()
    {
        if ( empty( self::$actionList ) )
        {
            return;
        }

        $fileContentCache = array();
        $doneDestList = array();

        $ini = eZINI::instance( 'staticcache.ini');
        $clearByCronjob = ( $ini->variable( 'CacheSettings', 'CronjobCacheClear' ) == 'enabled' );

        if ( $clearByCronjob )
        {
            $db = eZDB::instance();
        }

        foreach ( self::$actionList as $action )
        {
            list( $action, $parameters ) = $action;

            switch( $action ) {
                case 'store':
                    list( $destination, $source ) = $parameters;

                    if ( isset( $doneDestList[$destination] ) )
                        continue 2;

                    if ( $clearByCronjob )
                    {
                        $param = $db->escapeString( $destination . ',' . $source );
                        $db->query( 'INSERT INTO ezpending_actions( action, param ) VALUES ( \'static_store\', \''. $param . '\' )' );
                        $doneDestList[$destination] = 1;
                    }
                    else
                    {
                        if ( !isset( $fileContentCache[$source] ) )
                        {
                            if ( eZHTTPTool::getDataByURL( $source, true, eZStaticCache::USER_AGENT ) )
                                $fileContentCache[$source] = eZHTTPTool::getDataByURL( $source, false, eZStaticCache::USER_AGENT );
                            else
                                $fileContentCache[$source] = false;
                        }
                        if ( $fileContentCache[$source] === false )
                        {
                            eZDebug::writeError( "Could not grab content (from $source), is the hostname correct and Apache running?", 'Static Cache' );
                        }
                        else
                        {
                            eZStaticCache::storeCachedFile( $destination, $fileContentCache[$source] );
                            $doneDestList[$destination] = 1;
                        }
                    }
                    break;
            }
        }
        self::$actionList = array();
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:62,代码来源:ezstaticcache.php

示例15: foreach

            foreach ($xmlData as $doc) {
                if (is_object($doc)) {
                    if (is_object($doc->Doc)) {
                        $doc->Doc->formatOutput = true;
                        $xml[] = $doc->Doc->saveXML($doc->RootElement);
                    } else {
                        $dom = new DOMDocument();
                        $dom->preserveWhiteSpace = FALSE;
                        $dom->loadXML($doc->docToXML());
                        $dom->formatOutput = TRUE;
                        $xml[] = $dom->saveXML($dom->documentElement);
                    }
                }
            }
            $solrBase = new eZSolrBase();
            $version = json_decode(eZHTTPTool::getDataByURL($solrBase->SearchServerURI . '/admin/system/?wt=json'), true);
            $solr = array('ping' => trim(print_r($solrBase->ping(), 1)), 'version' => trim(print_r($version, 1)));
        } else {
            $error = "Current user can not read object {$objectID}";
        }
    } else {
        $error = "Object {$objectID} not found";
    }
}
$tpl->setVariable('error', $error);
$tpl->setVariable('info', $info);
$tpl->setVariable('detail', $detail);
$tpl->setVariable('xml', $xml);
$tpl->setVariable('solr', $solr);
echo $tpl->fetch('design:index/object.tpl');
eZDisplayDebug();
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:31,代码来源:object.php


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