Great little php URL parser
You can get varied results with parse_url
in php. This class gets great results, check it out:
https://github.com/monkeysuffrage/phpuri
Example
require 'phpuri.php';
$uri = phpUri::parse('https://www.google.com/foo?q=bar');
echo $uri->scheme;
echo $uri->authority;
echo $uri->path;
echo $uri->query;
//==> https://
//==> google.com
//==> foo
//==> ?q=bar
Benchmarks
rel2abs: successes -> 26, fails => 9, time: 0.001301
url_to_absolute: successes -> 32, fails => 3, time: 0.0029089999999999
phpuri: successes -> 35, fails => 0, time: 0.002402
Written by Will
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Related Tags
#php
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#