PHP code example of peterpostmann / parse_uri
1. Go to this page and download the library: Download peterpostmann/parse_uri library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
peterpostmann / parse_uri example snippets
# URIs (with standard components)
array (size=1)
'path' => string '/path/to/file.ext' (length=17)
array (size=1)
'path' => string 'relative/path/to/file.ext' (length=25)
array (size=1)
'path' => string 'fileInCwd.ext' (length=13)
array (size=1)
'path' => string 'C:\path\to\winfile.ext' (length=22)
array (size=1)
'path' => string 'C:\path\to\winfile.ext' (length=22)
array (size=3)
'scheme' => string 'file' (length=4)
'host' => string 'smbserver' (length=9)
'path' => string '/share/path/to/winfile.ext' (length=26)
array (size=3)
'scheme' => string 'file' (length=4)
'host' => string '' (length=0)
'path' => string '/path/to/file.ext' (length=17)
array (size=6)
'scheme' => string 'http' (length=4)
'host' => string 'example.org' (length=11)
'port' => int 8888
'user' => string 'user' (length=4)
'pass' => string 'pass' (length=4)
'path' => string '/path/to/file' (length=13)
array (size=2)
'scheme' => string 'news' (length=4)
'path' => string 'comp.infosystems.www.servers.unix' (length=33)
# URIs (with additional components)
array (size=5)
'path' => string 'C:\path\to\winfile.ext' (length=22)
'_protocol' => string 'file' (length=4)
'_document' => string 'C:\path\to\winfile.ext' (length=22)
'_ressource' => string 'C:\path\to\winfile.ext' (length=22)
'_uri' => string 'C:\path\to\winfile.ext' (length=22)
array (size=8)
'scheme' => string 'file' (length=4)
'host' => string 'smbserver' (length=9)
'path' => string '/share/path/to/winfile.ext' (length=26)
'_protocol' => string 'file' (length=4)
'_authority' => string 'smbserver' (length=9)
'_document' => string '/share/path/to/winfile.ext' (length=26)
'_ressource' => string '/share/path/to/winfile.ext' (length=26)
'_uri' => string '/share/path/to/winfile.ext' (length=26)
array (size=7)
'scheme' => string 'file' (length=4)
'host' => string '' (length=0)
'path' => string '/path/to/file.ext' (length=17)
'_protocol' => string 'file' (length=4)
'_document' => string 'file:///path/to/file.ext' (length=24)
'_ressource' => string 'file:///path/to/file.ext' (length=24)
'_uri' => string 'file:///path/to/file.ext' (length=24)
array (size=12)
'scheme' => string 'http' (length=4)
'host' => string 'example.org' (length=11)
'port' => int 8888
'user' => string 'user' (length=4)
'pass' => string 'pass' (length=4)
'path' => string '/path/to/file' (length=13)
'_protocol' => string 'http' (length=4)
'_userinfo' => string 'user:pass@' (length=10)
'_authority' => string 'user:[email protected] :8888' (length=26)
'_document' => string 'http://user:[email protected] :8888/path/to/file' (length=46)
'_ressource' => string 'http://user:[email protected] :8888/path/to/file' (length=46)
'_uri' => string 'http://user:[email protected] :8888/path/to/file' (length=46)
array (size=6)
'scheme' => string 'news' (length=4)
'path' => string 'comp.infosystems.www.servers.unix' (length=33)
'_protocol' => string 'news' (length=4)
'_document' => string 'news:comp.infosystems.www.servers.unix' (length=38)
'_ressource' => string 'news:comp.infosystems.www.servers.unix' (length=38)
'_uri' => string 'news:comp.infosystems.www.servers.unix' (length=38)
https://example.org/path/to/otherfile?query#fragment
ssh2.sftp://user:[email protected] :422/file.php?var1=val1&var2=val2#anchor
news:comp.infosystems.www.servers.unix
data:text/plain;base64,SSBsb3ZlIFBIUAo='
zlib:archive.zip#dir/file.txt
php:stdin