Thread: grabbing urls

    #1
  1. No Profile Picture
    try a linux desktop today!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Vancouver
    Posts
    23
    Rep Power
    0
    Hi all,

    user lands on page with info from url. ie: /page.php3?123456

    How do I retrieve the value and place in a variable? ie: $reffString = '123456';

    I saw a reference to this somewhere and can't find it again...

    TIA,
    Jay
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    20
    Rep Power
    0
    Correct me if I'm wrong, but wouldn't you want the url to read:

    /page.php3?var=123456?

    $var would then be equal to "123456"



    ------------------
    ---------
    Lanny
    dtm
  4. #3
  5. No Profile Picture
    try a linux desktop today!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Vancouver
    Posts
    23
    Rep Power
    0
    Ahem. I am feeling a little silly here... Yes, immortal, you are certainly correct

    What about storing the url? I was intending to grab the whole thing and split it at the '?'. This is an environmental var, no?

    Jay
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    1
    Rep Power
    0
    I may be wrong but don't you define it by "$variable_here=getenv("HTTP_REFERER")"
  8. #5
  9. No Profile Picture
    try a linux desktop today!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Vancouver
    Posts
    23
    Rep Power
    0
    Thanks Joshua, that's the ticket. As a phph newbie, I am again impressed at how straightforward the usage is.

    Jay
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    63
    Rep Power
    15
    I think you're making it a little more complicated than it is... consider the url
    www.myurl.com/test.php3?test=1234

    When that page is requested, php can immediately use the variable $test. Try it. Create a page called test.php3 with the following code:

    <? echo $test?>

    Then type in the url and hit enter. You'll see the value of the url parameter "test" print out... so you should see 1234

    ------------------
    ----------------------
    Ulysses J Ludwig
    Consultant
    Ujludwig@yahoo.com
    213.948.8278
  12. #7
  13. No Profile Picture
    try a linux desktop today!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Vancouver
    Posts
    23
    Rep Power
    0
    Thanks very much to all. Ulysses, you are definitely correct - I was over complicating things.

    What joy to see how staightforward php is

    Thanks to all.

    Jay
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    1
    Rep Power
    0
    I think the variable you are looking for is $QUERY_STRING. For the url test.php3?showthis the system variable $QUERY_STRING will bring up 'showthis'. By this you don't have to assign an extra variable.

    ------------------
    Mike Schaefer www.twst.com

    [This message has been edited by Mike Schaefer (edited June 28, 2000).]

    [This message has been edited by Mike Schaefer (edited June 28, 2000).]

Similar Threads

  1. code to get urls
    By fidelis in forum PHP Development
    Replies: 0
    Last Post: January 24th, 2004, 02:12 AM
  2. How can I make URLs to links and wrap them up?
    By sensei in forum PHP Development
    Replies: 2
    Last Post: April 27th, 2003, 06:47 AM
  3. page grabbing keeping full urls
    By deanbayley in forum PHP Development
    Replies: 1
    Last Post: March 5th, 2003, 07:58 AM
  4. Creating Back To X URL's
    By ChrisF in forum Perl Programming
    Replies: 5
    Last Post: June 25th, 2002, 09:07 AM
  5. pcntl_fork & Grabbing Multiple URLS
    By Boysherman in forum PHP Development
    Replies: 1
    Last Post: April 29th, 2002, 11:10 AM

IMN logo majestic logo threadwatch logo seochat tools logo