Changes between some lines

This is a discussion on Changes between some lines within the PHP Language forums, part of the PHP Programming Forums category; I have some files with urls and the only change between the urls is the id, which stands as an ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-25-2007
The87Boy
 
Posts: n/a
Default Changes between some lines

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?
Reply With Quote
  #2 (permalink)  
Old 12-25-2007
The87Boy
 
Posts: n/a
Default Re: Changes between some lines

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?


Reply With Quote
  #3 (permalink)  
Old 12-27-2007
Rik Wasmus
 
Posts: n/a
Default Re: Changes between some lines

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

> 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?


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

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;
}
--
Rik Wasmus
Reply With Quote
  #4 (permalink)  
Old 12-28-2007
The87Boy
 
Posts: n/a
Default Re: Changes between some lines

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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:03 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0