Skip to content

Bahlor/URL-Parser---PHP-Class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

URL-Parser---PHP-Class

A php class for parsing urls very simply. Feel free to contribute. :)

Freely distributable under the MIT License.

Basic example

================

Lets take the following example:

<?php
include('urlparser.class.php');

$url    = 'http://www.testurl.de/some/kind/of/path/?and=some&kind=of&query';

$parser = new parseURL($url);
print_r($parser);
echo 'Protocol: '.$parser->get('protocol').'<br />';
echo 'Host: '.$parser->get('host').'<br />';
echo 'Path: '.print_r($parser->get('path'),true).'<br />';
echo 'Query: '.print_r($parser->get('query'),true).'<br />';

?>

This would ouput:

Protocol: http
Host: www.testurl.de
Path: Array ( [0] => some [1] => kind [2] => of [3] => path ) 
Query: Array ( [and] => some [kind] => of [query] => 1 ) 

About

A very simple php class for parsing urls very simply

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages