Accessing URL parameters

Accessing URL parameters

am 31.12.2007 18:24:28 von Aaron Gray

How do I access URL parameters, and ideally as an associative array ?

Many thanks in adance,

Aaron

Re: Accessing URL parameters

am 31.12.2007 18:31:47 von luiheidsgoeroe

On Mon, 31 Dec 2007 18:24:28 +0100, Aaron Gray
wrote:

> How do I access URL parameters, and ideally as an associative array ?
>
> Many thanks in adance,

Do you want to examine the URL string?
http://www.php.net/parse_url
http://www.php.net/parse_str

Or in the current request, it's offcourse in the $_GET array.
--
Rik Wasmus

Re: Accessing URL parameters

am 31.12.2007 18:45:07 von Aaron Gray

"Rik Wasmus" wrote in message
news:op.t37my9gb5bnjuv@metallium.lan...
> On Mon, 31 Dec 2007 18:24:28 +0100, Aaron Gray
> wrote:
>
>> How do I access URL parameters, and ideally as an associative array ?
>>
>> Many thanks in adance,
>
> Do you want to examine the URL string?
> http://www.php.net/parse_url
> http://www.php.net/parse_str
>
> Or in the current request, it's offcourse in the $_GET array.

parse_url() looke helpful, but I wanted the current pages URL parameters, is
the $_GET ?

Aaron

Re: Accessing URL parameters

am 31.12.2007 18:53:14 von luiheidsgoeroe

On Mon, 31 Dec 2007 18:45:07 +0100, Aaron Gray =

wrote:

> "Rik Wasmus" wrote in message
> news:op.t37my9gb5bnjuv@metallium.lan...
>> On Mon, 31 Dec 2007 18:24:28 +0100, Aaron Gray =

>> wrote:
>>
>>> How do I access URL parameters, and ideally as an associative array =
?
>>>
>>> Many thanks in adance,
>>
>> Do you want to examine the URL string?
>> http://www.php.net/parse_url
>> http://www.php.net/parse_str
>>
>> Or in the current request, it's offcourse in the $_GET array.
>
> parse_url() looke helpful, but I wanted the current pages URL =

> parameters, is
> the $_GET ?

The parameters from the query string indeed.

http://www.example.com/path/to/file.ext?foo=3Dfoz&bar=3Dbaz

...will result in a $_GET array while running file.ext:
array(
'foo' =3D> 'foz',
'bar' =3D> 'baz')

If you want other information as well, search the $_SERVER array for you=
r =

needs.
-- =

Rik Wasmus

Re: Accessing URL parameters

am 31.12.2007 19:00:16 von ivansanchez-alg

Aaron Gray wrote:

> How do I access URL parameters, and ideally as an associative array ?

$_GET

Cheers,
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Proudly running Debian Linux with 2.6.22-3-amd64 kernel, KDE 3.5.8, and PHP
5.2.4-2 generating this signature.
Uptime: 19:00:06 up 39 days, 5:15, 4 users, load average: 0.62, 0.51,
0.56

Re: Accessing URL parameters

am 31.12.2007 19:55:45 von Aaron Gray

"Rik Wasmus" wrote in message
news:op.t37ny0i05bnjuv@metallium.lan...
On Mon, 31 Dec 2007 18:45:07 +0100, Aaron Gray
wrote:

> "Rik Wasmus" wrote in message
> news:op.t37my9gb5bnjuv@metallium.lan...
>> On Mon, 31 Dec 2007 18:24:28 +0100, Aaron Gray
>> wrote:
>>
>>> How do I access URL parameters, and ideally as an associative array ?
>>>
>>> Many thanks in adance,
>>
>> Do you want to examine the URL string?
>> http://www.php.net/parse_url
>> http://www.php.net/parse_str
>>
>> Or in the current request, it's offcourse in the $_GET array.
>
> parse_url() looke helpful, but I wanted the current pages URL parameters,
> is
> the $_GET ?

The parameters from the query string indeed.

http://www.example.com/path/to/file.ext?foo=foz&bar=baz

...will result in a $_GET array while running file.ext:
array(
'foo' => 'foz',
'bar' => 'baz')

If you want other information as well, search the $_SERVER array for your
needs.

Thanks,

Aaron