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


PHP libxml_set_streams_context函数代码示例

本文整理汇总了PHP中libxml_set_streams_context函数的典型用法代码示例。如果您正苦于以下问题:PHP libxml_set_streams_context函数的具体用法?PHP libxml_set_streams_context怎么用?PHP libxml_set_streams_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: embedImageURL

function embedImageURL($url)
{
    $url .= "/details/xs";
    // PHP5 befigyel!!!
    $doc = new DOMDocument();
    $opts = array('http' => array('max_redirects' => 100));
    $resource = stream_context_get_default($opts);
    $context = stream_context_create($opts);
    libxml_set_streams_context($context);
    // Pattogna kulonben a cookie miatt, kenytelenek vagyunk curl-t hasznalni
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_COOKIEFILE, "cookiefile");
    curl_setopt($curl, CURLOPT_COOKIEJAR, "cookiefile");
    # SAME cookiefile
    if (@$doc->loadHTML(curl_exec($curl))) {
        if ($retnode = $doc->getElementById("textfield-url")) {
            echo "megy";
            return "<img src=\"{$retnode->nodeValue}\">";
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:nizoo,项目名称:php-oembed,代码行数:27,代码来源:forum.php

示例2: __construct

 public function __construct(ConfigInterface $config, $xsdUrl)
 {
     $this->url = $xsdUrl;
     // Generate a stream context used by libxml to access external resources.
     // This will allow DOMDocument to load XSDs through a proxy.
     $streamContextFactory = new StreamContextFactory();
     libxml_set_streams_context($streamContextFactory->create($config));
     $document = new DOMDocument();
     $loaded = $document->load($xsdUrl);
     if (!$loaded) {
         throw new Exception('Unable to load XML from ' . $xsdUrl);
     }
     parent::__construct($document, $document->documentElement);
     // Register the schema to avoid cyclic imports.
     self::$loadedUrls[] = $xsdUrl;
     // Locate and instantiate schemas which are referenced by the current schema.
     // A reference in this context can either be
     // - an import from another namespace: http://www.w3.org/TR/xmlschema-1/#composition-schemaImport
     // - an include within the same namespace: http://www.w3.org/TR/xmlschema-1/#compound-schema
     $this->referereces = array();
     foreach ($this->xpath('//wsdl:import/@location|' . '//s:import/@schemaLocation|' . '//s:include/@schemaLocation') as $reference) {
         $referenceUrl = $reference->value;
         if (strpos($referenceUrl, '//') === false) {
             $referenceUrl = dirname($xsdUrl) . '/' . $referenceUrl;
         }
         if (!in_array($referenceUrl, self::$loadedUrls)) {
             $this->referereces[] = new SchemaDocument($config, $referenceUrl);
         }
     }
 }
开发者ID:aaronbauman,项目名称:wsdl2phpgenerator,代码行数:30,代码来源:SchemaDocument.php

示例3: createStream

 public function createStream()
 {
     // Register Stream Wrapper
     stream_wrapper_register("efm", "XslTemplateLoaderStream");
     $exsl = $this->getFunctions();
     $opts = array('efm' => array('namespaces' => $exsl['declarations'], 'functions' => $exsl['functions']));
     $streamContext = stream_context_create($opts);
     libxml_set_streams_context($streamContext);
 }
开发者ID:ashooner,项目名称:exsl_function_manager,代码行数:9,代码来源:class.functionmanager.php

示例4: retrieveDefinitions

 public function retrieveDefinitions()
 {
     Utils::log(LOG_DEBUG, "Retreiving definitions from the " . OvalRedHat::getName() . " OVAL", __FILE__, __LINE__);
     $defs = array();
     foreach ($this->getSubSourceDefs() as $subSourceDef) {
         # Loading the defined file
         $oval = new DOMDocument();
         libxml_set_streams_context(Utils::getStreamContext());
         $oval->load($subSourceDef->getUri());
         if ($oval === FALSE) {
             Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
             throw new Exception("Cannot load OVAL [source URI=" . $subSourceDef->getUri() . "]");
         }
         # Get the XPath
         $this->_xpath = new DOMXPath($oval);
         $this->_xpath->registerNamespace("def", "http://oval.mitre.org/XMLSchema/oval-definitions-5");
         $xDefinitions = $this->_xpath->query("/def:oval_definitions/def:definitions/def:definition");
         # Go through all definitions
         foreach ($xDefinitions as $xDefinition) {
             $def = array();
             $def['subSourceDefId'] = $subSourceDef->getId();
             $def['definition_id'] = $xDefinition->attributes->item(0)->value;
             $el_severity = $xDefinition->getElementsByTagName('severity')->item(0);
             if (!empty($el_severity)) {
                 $def['severity'] = $el_severity->nodeValue;
             } else {
                 $def['severity'] = "n/a";
             }
             $def['title'] = rtrim($xDefinition->getElementsByTagName('title')->item(0)->nodeValue);
             $def['ref_url'] = $xDefinition->getElementsByTagName('reference')->item(0)->getAttribute('ref_url');
             // Get associated CVEs
             $cve_query = 'def:metadata/def:advisory/def:cve';
             $cves = $this->_xpath->query($cve_query, $xDefinition);
             $def['cves'] = array();
             $def['os'] = array();
             foreach ($cves as $cve) {
                 array_push($def['cves'], $cve->nodeValue);
             }
             // Processing criteria
             $root_criterias_query = 'def:criteria';
             $root_criterias = $this->_xpath->query($root_criterias_query, $xDefinition);
             foreach ($root_criterias as $root_criteria) {
                 $os = null;
                 $package = array();
                 $this->processCriterias($this->_xpath, $root_criteria, $def, $os, $package);
             }
             array_push($defs, $def);
         }
         $this->updateSubSourceLastChecked($subSourceDef);
     }
     return $defs;
 }
开发者ID:basvandervlies,项目名称:pakiti3,代码行数:52,代码来源:OvalRedHat.php

示例5: links_from_site

 /**	Load the page, parse for iconic links, and add them to icon list if
 		they are valid.
 	*/
 protected function links_from_site()
 {
     /*
     	Quietly fetch the site contents into a DOM
     */
     $dom = new DOMDocument();
     $dom->recover = true;
     $dom->strictErrorChecking = false;
     $default_context = stream_context_get_default();
     $stream_context = stream_context_create($this->stream_context_options);
     libxml_set_streams_context($stream_context);
     $libxml_err_state = libxml_use_internal_errors(true);
     $dom_result = @$dom->loadHTMLFile($this->site_url);
     libxml_clear_errors();
     libxml_use_internal_errors($libxml_err_state);
     libxml_set_streams_context($default_context);
     if ($dom_result === false) {
         $status = self::header_findr($http_response_header, null);
         @(list(, $status, ) = explode(' ', $status, 3));
         $status = (int) $status;
         trigger_error('site \'' . $this->site_url . '\' returned ' . $status, E_USER_NOTICE);
         return false;
     }
     /*
     	If we followed any redirects, rewrite the site_url with the current
     	location, so that relative urls may be correctly converted into
     	their absolute form.
     */
     $location = self::header_findr($http_response_header, 'Location');
     if ($location !== null) {
         $this->site_url = $location;
     }
     /* check all the links which relate to icons */
     foreach ($dom->getElementsByTagName('link') as $link) {
         $relations = explode(' ', $link->getAttribute('rel'));
         if (in_array('icon', array_map('strtolower', $relations))) {
             $href = $link->getAttribute('href');
             $href_absolute = $this->absolutize_url($href);
             $icon = $this->validate_icon($href_absolute);
             if ($icon !== null) {
                 if (empty($icon['type'])) {
                     $icon['type'] = $link->getAttribute('type');
                 }
                 if (empty($icon['sizes'])) {
                     $icon['sizes'] = $link->getAttribute('sizes');
                 }
                 $this->favicons[] = $icon;
             }
         }
     }
 }
开发者ID:RomanSixty,项目名称:Feed-on-Feeds,代码行数:54,代码来源:favicon.php

示例6: __construct

 function __construct()
 {
     require_once 'constants.php';
     if (PROXY) {
         // Define the default, system-wide context.
         $r_default_context = stream_context_get_default(array('http' => array('proxy' => PROXY_IP . ":" . PROXY_PORT, 'request_fulluri' => True, 'timeout' => 8)));
         // Though we said system wide, some extensions need a little coaxing.
         libxml_set_streams_context($r_default_context);
     } else {
         // Define the default, system-wide context.
         $r_default_context = stream_context_get_default(array('http' => array('timeout' => 8)));
         // Though we said system wide, some extensions need a little coaxing.
         libxml_set_streams_context($r_default_context);
     }
 }
开发者ID:ankita1234,项目名称:search-engine,代码行数:15,代码来源:funcs.php

示例7: loadSettings

 public function loadSettings()
 {
     libxml_set_streams_context($this->ctx);
     libxml_use_internal_errors(true);
     $this->setCommand(['trigger' => 'c', 'action' => 'c', 'arguments' => -1, 'determiter' => ',', 'help' => 'Randomize arguments. Determiter is set as ",". Example: "!c apple, banana, oranges".']);
     $this->setCommand(['trigger' => 'iroha', 'action' => 'iroha', 'arguments' => 1, 'channels' => ['#bodzio', '#xandros'], 'help' => 'Sending a link to episode. Just type "!iroha <nr of episode>" to get link.']);
     $this->setCommand(['trigger' => 'kier', 'channels' => ['#bodzio', '#xandros'], 'action' => 'kier']);
     $this->setCommand(['trigger' => 'random', 'action' => 'random', 'arguments' => -1, 'help' => '"!random" default search loli, but you can find anything you want. ' . 'You can change rating by adding safe|nsfw|ques to arguments and change ' . 'image server by adding yan (yande.re).', 'ban' => ['nick' => 'Thebassa']]);
     $this->setCommand(['trigger' => 'biba', 'reply' => 'Biba dance: https://www.youtube.com/watch?v=kpJcgkEdMRg']);
     $this->setCommand(['trigger' => 'hubi1', 'channels' => ['#bodzio'], 'reply' => '[10:31pm] <+hubi1> k-on byl fajny']);
     $this->setCommand(['trigger' => 'maido', 'reply' => 'Maido dance: https://www.youtube.com/watch?v=a-7_XdPktgc']);
     $this->setCommand(['trigger' => 'mikuluka', 'reply' => 'https://www.youtube.com/watch?v=ZllY2wBLYN4']);
     $this->setCommand(['trigger' => 'okusama04', 'channels' => ['#bodzio'], 'notice' => 'prosze: https://mega.co.nz/#!HplkQaCZ!gTgt_BjzpEoUe6-5_ObXke_PDM-S9Me6xz8aW_cVD0A']);
     $this->setCommand(['trigger' => 'nonnon11', 'channels' => ['#bodzio'], 'notice' => 'prosze: https://mega.nz/#!qolFGZpb!T3Ic5DDJKOy4TBp1xHnDtT4T9ctzianr-ofW_EZ9eT0']);
     $this->setCommand(['trigger' => 'rolypoly', 'reply' => 'Roly-poly: http://www.youtube.com/watch?v=3Xolk2cFzlo']);
     $this->setCommand(['trigger' => 'weaboo', 'reply' => 'Weaboo song: https://www.youtube.com/watch?v=TBfWKmRFTjM']);
     $this->setCommand(['trigger' => 'xandros', 'reply' => '[9:58pm] <Inkwizytor> xandros, kup sobie slownik']);
     $this->setCommand(['trigger' => 'cycki', 'action' => 'cycki']);
     parent::loadSettings();
 }
开发者ID:xandros15,项目名称:Saya-Bot,代码行数:20,代码来源:Fun.php

示例8: checkPSVersion

 /**
  * checkPSVersion ask to prestashop.com if there is a new version. return an array if yes, false otherwise
  * 
  * @return mixed
  */
 public function checkPSVersion($force = false)
 {
     if (class_exists('Configuration')) {
         $last_check = Configuration::get('PS_LAST_VERSION_CHECK');
     } else {
         $last_check = 0;
     }
     // if we use the autoupgrade process, we will never refresh it
     // except if no check has been done before
     if ($force || $last_check < time() - 3600 * Upgrader::DEFAULT_CHECK_VERSION_DELAY_HOURS) {
         libxml_set_streams_context(@stream_context_create(array('http' => array('timeout' => 3))));
         if ($feed = @simplexml_load_file($this->rss_version_link)) {
             $this->version_name = (string) $feed->version->name;
             $this->version_num = (string) $feed->version->num;
             $this->link = (string) $feed->download->link;
             $this->md5 = (string) $feed->download->md5;
             $this->changelog = (string) $feed->download->changelog;
             $this->autoupgrade = (int) $feed->autoupgrade;
             $this->autoupgrade_module = (int) $feed->autoupgrade_module;
             $this->autoupgrade_last_version = (string) $feed->autoupgrade_last_version;
             $this->autoupgrade_module_link = (string) $feed->autoupgrade_module_link;
             $this->desc = (string) $feed->desc;
             $config_last_version = array('name' => $this->version_name, 'num' => $this->version_num, 'link' => $this->link, 'md5' => $this->md5, 'autoupgrade' => $this->autoupgrade, 'autoupgrade_module' => $this->autoupgrade_module, 'autoupgrade_last_version' => $this->autoupgrade_last_version, 'autoupgrade_module_link' => $this->autoupgrade_module_link, 'changelog' => $this->changelog, 'desc' => $this->desc);
             if (class_exists('Configuration')) {
                 Configuration::updateValue('PS_LAST_VERSION', serialize($config_last_version));
                 Configuration::updateValue('PS_LAST_VERSION_CHECK', time());
             }
         }
     } else {
         $this->loadFromConfig();
     }
     // retro-compatibility :
     // return array(name,link) if you don't use the last version
     // false otherwise
     if (version_compare(_PS_VERSION_, $this->version_num, '<')) {
         $this->need_upgrade = true;
         return array('name' => $this->version_name, 'link' => $this->link);
     } else {
         return false;
     }
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:46,代码来源:Upgrader.php

示例9: registerXmlStreamContext

 /**
  * This is added to fix a bug with remote DTDs that are blocking automated php request on some domains:
  * @link http://stackoverflow.com/questions/4062792/domdocumentvalidate-problem
  * @link https://bugs.php.net/bug.php?id=48080
  */
 private function registerXmlStreamContext()
 {
     libxml_set_streams_context(stream_context_create(array('http' => array('user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:43.0) Gecko/20100101 Firefox/43.0'))));
 }
开发者ID:brunocoelhor,项目名称:grumphp,代码行数:9,代码来源:XmlLinter.php

示例10: generate

 /**
  * Execute the code generation
  */
 public function generate()
 {
     /*
      * PROXY CONFIGURATION
      */
     $proxy = current(array_filter(array(getenv('HTTP_PROXY'), getenv('http_proxy')), 'strlen'));
     if ($proxy) {
         $parsedWsdlPath = Url::createFromUrl($this->config->getWsdlDocumentPath());
         // if not fetching the wsdl file from filesystem and a proxy has been set
         if ($parsedWsdlPath->getScheme()->get() !== 'file') {
             $proxy = Url::createFromUrl($proxy);
             libxml_set_streams_context(stream_context_get_default(array($proxy->getScheme()->get() => array('proxy' => 'tcp://' . $proxy->getAuthority() . $proxy->getRelativeUrl(), 'request_fulluri' => true))));
         }
     }
     unset($proxy);
     /*
      * LOAD THE WSDL DOCUMENT
      */
     $wsdlDocument = SimpleXMLElement::loadFile($this->config->getWsdlDocumentPath());
     $wsdlDocument->registerXPathNamespace('wsdl', static::WSDL_NS);
     $schemaReader = new SchemaReader();
     /* @var \Goetas\XML\XSDReader\Schema\Schema[] $schemas */
     $schemas = array();
     /* @var \Goetas\XML\XSDReader\Schema\Type\Type[] $types */
     $types = array();
     /*
      * LOAD THE XML SCHEMAS
      */
     // read the schemas included in the wsdl document
     foreach ($wsdlDocument->xpath('/wsdl:definitions/wsdl:types/xsd:schema') as $schemaNode) {
         $schemas[] = $schemaReader->readNode(dom_import_simplexml($schemaNode));
     }
     // exclude the schemas having the following namespaces
     $unusedSchemaNamespaces = array(SchemaReader::XML_NS, SchemaReader::XSD_NS);
     // recursively read all the schema chain
     $processedSchemas = array();
     while (!empty($schemas)) {
         /* @var \Goetas\XML\XSDReader\Schema\Schema $currentSchema */
         $currentSchema = array_shift($schemas);
         if (!in_array($currentSchema, $processedSchemas) and !in_array($currentSchema->getTargetNamespace(), $unusedSchemaNamespaces)) {
             $processedSchemas[] = $currentSchema;
             $schemas = array_merge($schemas, $currentSchema->getSchemas());
         }
     }
     $schemas = $processedSchemas;
     // cleanup
     unset($currentSchema);
     unset($processedSchemas);
     unset($unusedSchemaNamespaces);
     unset($schemaNode);
     unset($schemaReader);
     /*
      * LOAD THE DEFINED TYPES
      */
     // get the complete list of defined types
     foreach ($schemas as $schema) {
         $types = array_merge($types, $schema->getTypes());
     }
     /*
      * LOAD THE SERVICES
      */
     $services = $wsdlDocument->xpath('/wsdl:definitions/wsdl:portType');
     /*
      * CODE GENERATION
      */
     $classFactory = new ClassFactory($this->config, $schemas, $types);
     foreach ($types as $type) {
         if ($type instanceof SimpleType) {
             // build the inheritance chain of the current SimpleType
             /* @var \Goetas\XML\XSDReader\Schema\Type\SimpleType[] $inheritanceChain */
             $inheritanceChain = array($type->getRestriction());
             // loop through the type inheritance chain untill the base type
             while (end($inheritanceChain) !== null) {
                 $inheritanceChain[] = end($inheritanceChain)->getBase()->getParent();
             }
             // remove the null value
             array_pop($inheritanceChain);
             // remove the 'anySimpleType'
             array_pop($inheritanceChain);
             // now the last element of the chain is the base simple type
             // enums are built only of string enumerations
             if (end($inheritanceChain)->getBase()->getName() === 'string' and array_key_exists('enumeration', $type->getRestriction()->getChecks())) {
                 $className = $classFactory->createEnum($type);
                 $this->eventDispatcher->dispatch(Event::ENUM_CREATE, new Event($className));
             }
         } elseif ($type instanceof ComplexType) {
             $className = $classFactory->createDTO($type);
             $this->eventDispatcher->dispatch(Event::DTO_CREATE, new Event($className));
         }
     }
     foreach ($services as $service) {
         $className = $classFactory->createService($service);
         $this->eventDispatcher->dispatch(Event::SERVICE_CREATE, new Event($className));
     }
     $className = $classFactory->createClassmap();
     $this->eventDispatcher->dispatch(Event::CLASSMAP_CREATE, new Event($className));
     /*
//.........这里部分代码省略.........
开发者ID:xstefanox,项目名称:sapone,代码行数:101,代码来源:Generator.php

示例11: __construct

 /**
  * Parses the target wsdl and loads the interpretation into object members
  *
  * @param string $wsdl the URI of the wsdl to interpret
  * @param string $soapClientClassName the class name which the generated
  *     client will extend
  * @param array $classmap the class map to use when generating classes
  * @param string $serviceName the name of the service being worked on
  * @param string $version the version of the service
  * @param string $author the author to be placed in the file header
  * @param string $package the package to be placed in the file header
  * @param string $soapClientClassPath the class path to require for the
  *     SOAP client
  * @param string $proxy the proxy URL to use when downloading WSDLs
  * @throws WSDLInterpreterException container for all WSDL interpretation
  *     problems
  * @todo Create plug in model to handle extendability of WSDL files
  */
 public function __construct($wsdl, $soapClientClassName, $classmap, $conflictClassmap, $serviceName, $version, $author, $package, $soapClientClassPath, $proxy, $enablePseudoNamespaces, $skipClassNameCheckTypes)
 {
     try {
         $this->_wsdl = $wsdl;
         $this->_soapClientClassName = $soapClientClassName;
         $this->_serviceName = $serviceName;
         $this->_version = $version;
         $this->_author = $author;
         $this->_package = $package;
         if (isset($classmap)) {
             $this->_classmap = $classmap;
         }
         $this->_enablePseudoNamespaces = isset($enablePseudoNamespaces) ? $enablePseudoNamespaces : false;
         if (!$this->_enablePseudoNamespaces) {
             // Only use if pseudo-namespaces aren't enabled.
             if (isset($conflictClassmap)) {
                 $this->_classmap = array_merge($this->_classmap, $conflictClassmap);
             }
             if (isset($skipClassNameCheckTypes)) {
                 $this->_skipClassNameCheckTypes = $skipClassNameCheckTypes;
             }
         }
         $this->_soapClientClassPath = $soapClientClassPath;
         // Set proxy.
         if (!empty($proxy)) {
             $opts = array('http' => array('proxy' => $proxy, 'request_fulluri' => TRUE));
             $context = stream_context_get_default($opts);
             libxml_set_streams_context($context);
         }
         $this->_dom = new DOMDocument();
         $this->_dom->load($wsdl, LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NOENT | LIBXML_XINCLUDE);
         $xpath = new DOMXPath($this->_dom);
         // Service namespace.
         $this->_serviceNamespace = $this->_dom->documentElement->getAttribute('targetNamespace');
         /**
          * wsdl:import
          */
         $query = "//*[local-name()='import' and namespace-uri()='http://schemas.xmlsoap.org/wsdl/']";
         $entries = $xpath->query($query);
         foreach ($entries as $entry) {
             $parent = $entry->parentNode;
             $wsdl = new DOMDocument();
             $wsdl->load($entry->getAttribute("location"), LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NOENT | LIBXML_XINCLUDE);
             foreach ($wsdl->documentElement->childNodes as $node) {
                 $newNode = $this->_dom->importNode($node, true);
                 $parent->insertBefore($newNode, $entry);
             }
             $parent->removeChild($entry);
         }
         /**
          * xsd:import
          */
         $query = "//*[local-name()='import' and namespace-uri()='http://www.w3.org/2001/XMLSchema']";
         $entries = $xpath->query($query);
         foreach ($entries as $entry) {
             $parent = $entry->parentNode;
             $xsd = new DOMDocument();
             $result = @$xsd->load(dirname($this->_wsdl) . "/" . $entry->getAttribute("schemaLocation"), LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NOENT | LIBXML_XINCLUDE);
             if ($result) {
                 foreach ($xsd->documentElement->childNodes as $node) {
                     $newNode = $this->_dom->importNode($node, true);
                     $parent->insertBefore($newNode, $entry);
                 }
                 $parent->removeChild($entry);
             }
         }
         $this->_loadNamespaces($xpath);
         $this->_dom->formatOutput = true;
     } catch (Exception $e) {
         throw new WSDLInterpreterException("Error loading WSDL document (" . $e->getMessage() . ")");
     }
     try {
         $xsl = new XSLTProcessor();
         $xslDom = new DOMDocument();
         $xslDom->load(dirname(__FILE__) . "/wsdl2php.xsl");
         $xsl->registerPHPFunctions();
         $xsl->importStyleSheet($xslDom);
         $this->_dom = $xsl->transformToDoc($this->_dom);
         $this->_dom->formatOutput = true;
         //$this->_dom->save("dom.xml");
     } catch (Exception $e) {
         throw new WSDLInterpreterException("Error interpreting WSDL document (" . $e->getMessage() . ")");
//.........这里部分代码省略.........
开发者ID:phobik,项目名称:google-api-adwords-php,代码行数:101,代码来源:WSDLInterpreter.php

示例12: fetchBingResults

function fetchBingResults($query, $querysize, $msnsoapkey, $culture_info)
{
    // set proxy enviroment
    global $CFG;
    if (!empty($CFG->proxyhost)) {
        $r_default_context = stream_context_get_default(array('http' => array('proxy' => $CFG->proxyhost . ':' . $CFG->proxyport, 'request_fulluri' => True)));
        // Though we said system wide, some extensions need a little coaxing.
        libxml_set_streams_context($r_default_context);
    }
    $results = array();
    $request = 'http://api.bing.net/xml.aspx?Appid=' . $msnsoapkey . '&sources=web&Query=' . urlencode($query) . '&culture=' . $culture_info . '&Web.Options=DisableHostCollapsing+DisableQueryAlterations' . '&Options=DisableLocationDetection&Version=2.2';
    $response = new DOMDocument();
    $response->load($request);
    $webResults = $response->getElementsByTagName("WebResult");
    if ($webResults->length != 0) {
        foreach ($webResults as $value) {
            $results[] = $value->childNodes->item(2)->nodeValue;
        }
    }
    return $results;
}
开发者ID:abgreeve,项目名称:moodle-plagiarism_crot,代码行数:21,代码来源:locallib.php

示例13: stream_open

<?php

class TestWrapper
{
    function stream_open($path, $mode, $options, &$opened_path)
    {
        if ($this->context) {
            print_r(stream_context_get_options($this->context));
        }
        return false;
    }
    function url_stat($path, $flags)
    {
        return array();
    }
}
stream_wrapper_register("test", "TestWrapper") or die("Failed to register protocol");
$ctx1 = stream_context_create(array('test' => array('test' => 'test 1')));
$ctx2 = stream_context_create(array('test' => array('test' => 'test 2')));
stream_context_set_default(stream_context_get_options($ctx1));
@simplexml_load_file('test://sdfsdf');
libxml_set_streams_context($ctx2);
@simplexml_load_file('test://sdfsdf');
开发者ID:badlamer,项目名称:hhvm,代码行数:23,代码来源:bug54440.php

示例14: rmdir

            }
        }
        rmdir($directory);
    }
}
$installer = new Installer();
try {
    $installer->log('phpDocumentor installer for manual installations');
    // An IP was provided thus we set up proxying
    if (isset($argv[1]) && $argv[1] != 'dev') {
        // All HTTP requests are passed through the local NTLM proxy server.
        $r_default_context = stream_context_get_default(array('http' => array('proxy' => $argv[1], 'request_fulluri' => true)));
        // remove the second item in the array and reindex the keys
        array_splice($argv, 1, 1);
        // Though we said system wide, some extensions need a little coaxing.
        libxml_set_streams_context($r_default_context);
    }
    if (isset($argv[1]) && $argv[1] == 'dev') {
        $installer->log('> Downloading development application from Github');
        $installer->downloadDevelopmentPhpDocumentorArchive();
    } else {
        $installer->log('> Downloading application from Github');
        $installer->downloadLatestPhpDocumentorArchive();
    }
    $installer->log('> Extracting application');
    $installer->extractPhpDocumentorToCurrentDirectory();
    $installer->log('> Preparing dependencies');
    $composer_location = '';
    if (!$installer->testForComposer()) {
        // composer is not installed, install it to a temporary directory
        $composer_location = sys_get_temp_dir();
开发者ID:ri0t1985,项目名称:phpDocumentor2,代码行数:31,代码来源:installer.php

示例15: checkOpenSiVersion

 public static function checkOpenSiVersion($version)
 {
     libxml_set_streams_context(stream_context_create(array('http' => array('timeout' => 3))));
     if ($feed = @simplexml_load_file('http://www.opensi.fr/connect/version.xml') and $version < $feed->version->num) {
         return array('name' => $feed->version->name, 'link' => $feed->download->link);
     }
     return false;
 }
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:8,代码来源:config.inc.php


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