function parse($dsn = "php://input") { $put = fopen($dsn, "r"); $query_string = ''; while ($put_string = fread($put, 1024)) { $query_string .= $put_string; } $uri = new lmbUri(); $uri->setQueryString($query_string); return $uri->getQueryItems(); }
function __construct($dsn) { if (!is_object($dsn)) { $dsn = new lmbUri($dsn); } $this->dsn = $dsn; foreach ($dsn as $option_name => $option_value) { if (!is_null($option_value)) { $this->{$option_name} = $option_value; } } foreach ($dsn->getQueryItems() as $option_name => $option_value) { if (!is_null($option_value)) { $this->{$option_name} = $option_value; } } }
function testUrlDecode() { $test_value = '+text'; $uri = new lmbUri('/index.html?var=' . urlencode($test_value)); $q_items = $uri->getQueryItems(); $this->assertEqual($q_items['var'], $test_value); }