For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > December 2007 > Changes between some lines









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Changes between some lines
The87Boy

2007-12-25, 7:02 pm

I have some files with urls and the only change between the urls is
the id, which stands as an argument but how can I see the id it in the
easist way?
The87Boy

2007-12-25, 7:02 pm

On Dec 25, 8:09 pm, The87Boy <the87...@gmail.com> wrote:
> I have some files with urls and the only change between the urls is
> the id, which stands as an argument


As an argument in the url, as you e.g. can see on this url:
http://localhost/index.php?cmd=14&id=3325253&from=2

> but how can I see the id it in the easist way?


Rik Wasmus

2007-12-27, 7:02 pm

On Tue, 25 Dec 2007 20:21:38 +0100, The87Boy <the87boy@gmail.com> wrote:=

[color=darkred]
> On Dec 25, 8:09 pm, The87Boy <the87...@gmail.com> wrote:
>
> As an argument in the url, as you e.g. can see on this url:
> http://localhost/index.php?cmd=3D14...325253&from=3D2
>

In the request itself:
$_GET['id']

Parsing the url as a string in another file (if you'd like to examine th=
e =

target in another script for instance):
$id =3D false;
$url =3D 'http://localhost/index.php?cmd=3D14&id=3D3325253&from=3D2';
$querystring =3D parse_url($url, PHP_URL_QUERY);
if(!empty($querystring)){
parse_str($querystring,$array);
$id =3D isset($array['id']) ? $array['id'] : false;
}
-- =

Rik Wasmus
The87Boy

2007-12-28, 8:01 am

On Dec 27, 6:06 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> In the request itself:
> $_GET['id']


I already know this one, but it is possible, it is not localhost, and
there why I can not use this one

> Parsing the url as a string in another file (if you'd like to examine the
> target in another script for instance):
> $id = false;
> $url = 'http://localhost/index.php?cmd=14&id=3325253&from=2';
> $querystring = parse_url($url, PHP_URL_QUERY);
> if(!empty($querystring)){
> parse_str($querystring,$array);
> $id = isset($array['id']) ? $array['id'] : false;}


This was actually what I was searching for, but I did not know, there
was a PHP function, there why my question
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com