예제 #1
0
 /**
  * Parses the config and splits up the port + url
  * @return array
  */
 public function parse()
 {
     $proxy = $this->config->getSystemValue('proxy');
     $userpasswd = $this->config->getSystemValue('proxyuserpwd');
     $result = ['host' => null, 'port' => null, 'user' => null, 'password' => null];
     // we need to filter out the port -.-
     $url = new \Net_URL2($proxy);
     $port = $url->getPort();
     $url->setPort(false);
     $host = $url->getUrl();
     $result['host'] = $host;
     $result['port'] = $port;
     if ($userpasswd) {
         $auth = explode(':', $userpasswd, 2);
         $result['user'] = $auth[0];
         $result['password'] = $auth[1];
     }
     return $result;
 }
예제 #2
0
Port.......: <?php 
$url->port;
?>

File/path..: <?php 
$url->path;
?>

Querystring: <?php 
print_r($url->querystring);
?>

Anchor.....: <?php 
echo $url->anchor;
?>

Full URL...: <?php 
echo $url->getUrl();
?>


Resolve path (.././/foo/bar/joe/./././../jabba): <b><?php 
echo $url->resolve('.././/foo/bar/joe/./././../jabba');
?>
</b>
</pre>

</body>
</html>