Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpk/45bbb0f7dcf99920416f to your computer and use it in GitHub Desktop.
Save aaronpk/45bbb0f7dcf99920416f to your computer and use it in GitHub Desktop.
> url.parse('http://example.com/##example')
{ protocol: 'http:',
slashes: true,
auth: null,
host: 'example.com',
port: null,
hostname: 'example.com',
hash: '##example',
search: null,
query: null,
pathname: '/',
path: '/',
href: 'http://example.com/##example' }
$ php -r 'print_r(parse_url("http://example.com/##example"));'
Array
(
[scheme] => http
[host] => example.com
[path] => /
[fragment] => #example
)
>> require 'uri'
=> true
>> URI.parse 'http://example.com/##example'
URI::InvalidURIError: bad URI(is not URI?): http://example.com/##example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment