Load (and cache) a context document

@param string $url Context URL

@return \ML\JsonLD\RemoteDocument Remote document
542817
public function loadDocument($url)
    {
        // Try to return a cached document
        $document = $this->vocabularyCache->getDocument($url);
        if ($document instanceof RemoteDocument) {
            return $document;
        }

        return $this->vocabularyCache->setDocument($url, parent::loadDocument($url));
    }
781315
protected function parse($url) {
        // set the download file url
        $this->url = $url;

        // parse the url, to remove possible query parameters, otherwise it is not possible to fetch the extension
        $urlParsed = parse_url($url);

        // get the path info of the given name
        $pathinfo = pathinfo($urlParsed['path']);

        // get the base file name
        $this->nameOriginal = $pathinfo['filename'];

        // set the file name
        $this->extension = $pathinfo['extension'];

        // done, return the instance of this, to make chaining possible
        return $this;
    }
1037351
public function setUrl($url)
    {
        if (! empty($url)) {
            $segments = parse_url($url);

            foreach ($segments as $key => $value) {
                $this->$key = $value;
            }

            if ($this->format = pathinfo($this->path, PATHINFO_EXTENSION)) {
                $this->path = str_replace('.'.$this->format, '', $this->path);
            }
        }

        return $this;
    }
348381
public function loadFile($url)
    {
        //Locate the template
        $locator = $this->getObject('template.locator.factory')->createLocator($url);

        if (!$file = $locator->locate($url)) {
            throw new InvalidArgumentException(sprintf('The template "%s" cannot be located.', $url));
        }

        //Load the template
        if(!$source = file_get_contents($file)) {
            throw new RuntimeException(sprintf('The template "%s" cannot be loaded.', $file));
        }

        $this->_source = $source;

        return $this;
    }
828599
private function loadXML($url) {
		if (!file_exists($url)) {
			throw new \n2n\log4php\LoggerException("File [$url] does not exist.");
		}

		libxml_clear_errors();
		$oldValue = libxml_use_internal_errors(true);
		
		// Load XML
		$xml = @simplexml_load_file($url);
		if ($xml === false) {
			
			$errorStr = "";
			foreach(libxml_get_errors() as $error) {
				$errorStr .= "[" . $error->file . "] line " . $error->line . " : " . $error->message;
			}
			
			throw new \n2n\log4php\LoggerException("Error loading configuration file: " . trim($errorStr));
		}
		
		libxml_clear_errors();
		libxml_use_internal_errors($oldValue);
		
		return $xml;
	}
158329
public function loadResource(string $url, array $parameters): array
    {
        $signature = $this->createSignature($url, $parameters);
        if ($this->cache->has($signature)) {
            return $this->cache->get($signature);
        }

        $parameters['format'] = 'json';
        $parameters['api_key'] = $this->config->getApiKey();
        $url = $this->config->getApiEndpoint().$this->buildQueryUrl($url, $parameters);

        $response = $this->guzzle->request('GET', $url);
        $body = $this->processResponse($response);

        $this->cache->set($signature, $body['results']);

        return $body['results'];
    }
712582
protected function getFromStreamContext($url, $context)
    {

        $level = error_reporting(0);
        $body = file_get_contents($url, 0, $context);

        error_reporting($level);

        if ($body === false) {
            $error = error_get_last();
            $message = isset($error['message']) && $error['message'] ? $error['message'] : "Cannot read from $url.";
            throw new RuntimeException($message);
        }



        if (isset($http_response_header)) {
            $header = implode("\r\n", $http_response_header);
            return "$header\r\n\r\n$body";
        }

        return $body;
    }
1074875
public static function load($url, $user = null, $pass = null)
	{
		$xml = self::loadXml($url, $user, $pass);
		if ($xml->channel) {
			return self::fromRss($xml);
		} else {
			return self::fromAtom($xml);
		}
	}
395694
public function load($url, $cache = 3600)
    {
        if ($cache !== false) {
            Reader::setCache(new ZendCacheDriver('cache/expensive', $cache));
        }

        // Load the RSS feed, either from remote URL or from cache
        // (if specified above and still fresh)
        $feed = Reader::import($url);

        return $feed;
    }
559530
private static function loadContent($url) {
        //TODO: implement URL content load functionality with CURL and proxy

        $ch = curl_init($url);
        $options = array(
            CURLOPT_RETURNTRANSFER => true
        );
        curl_setopt_array($ch, $options);

        $content = curl_exec($ch);

        curl_close($ch);

        if ($content === false) {
            throw new Exception("Can't get content from " . $url);
        }
        return $content;
    }
437921
public function loadString($content, $url = null)
    {
        parent::loadString($content);

        //Let twig load the content by proxiing through the getSource() method.
        $this->_twig_template = $this->_twig->loadTemplate($content);

        //Push the template on the stack
        array_push($this->_stack, $url);
        return $this;
    }
1034396
public RemoteDocument loadDocument(String url) throws JsonLdError {
        if (m_injectedDocs.containsKey(url)) {
            try {
                return new RemoteDocument(url, m_injectedDocs.get(url));
            } catch (final Exception e) {
                throw new JsonLdError(JsonLdError.Error.LOADING_INJECTED_CONTEXT_FAILED, url, e);
            }
        } else {
            final String disallowRemote = System
                    .getProperty(DocumentLoader.DISALLOW_REMOTE_CONTEXT_LOADING);
            if ("true".equalsIgnoreCase(disallowRemote)) {
                throw new JsonLdError(JsonLdError.Error.LOADING_REMOTE_CONTEXT_FAILED,
                        "Remote context loading has been disallowed (url was " + url + ")");
            }

            try {
                return new RemoteDocument(url, JsonUtils.fromURL(new URL(url), getHttpClient()));
            } catch (final Exception e) {
                throw new JsonLdError(JsonLdError.Error.LOADING_REMOTE_CONTEXT_FAILED, url, e);
            }
        }
    }
928028
public function get_item($url) {
        $raw = $this->curl($url . '.json');
        $json = json_decode($raw, true);
        if (!$json) {
            return null;
        }

        return new Item($this, $url, $json);
    }
407541
function load($url) {
            if (empty($url)) return false;
            $this->parseXML(implode('', @file($url)));
        }
1018485
public function getDocument($url)
    {
        $urlHash = $this->getCacheHash($url, self::SLOT_DOC);

        // Try to retrieve the document from the cache
        if (Cache::getAdapter()->hasItem($urlHash)) {
            return Cache::getAdapter()->getItem($urlHash)->get();
        }

        return null;
    }
511758
protected function getStreamContext($url)
    {
        $host = parse_url($url, PHP_URL_HOST);

        if (PHP_VERSION_ID < 50600) {
            $this->options['ssl']['CN_match'] = $host;
            $this->options['ssl']['SNI_server_name'] = $host;
        }

        return $this->getMergedStreamContext($url);
    }
3828
protected function _getCURL($url) {
		curl_setopt($this->_curl, CURLOPT_URL, $url);
		$content = curl_exec($this->_curl);
		return $content;
	}