Grabbing Requested URL Variable

Discussion in 'PHP' started by agnostic, Jul 13, 2008.

  1. #1
    I'm trying to make a PHP script that grabs any variables followed by the php script... i.e. http://www.mydomain.com/script.php?user105 and when someone visits that script it would grab "user105" and save to a text file on the host. Or something that grabs the requested url and saves it to a text file.
     
    agnostic, Jul 13, 2008 IP
  2. revvi

    revvi Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Another approach:

    http://www.mydomain.com/script.php?var=user105

    Then to get the variable is by

    if (isset($_GET['var'])) $content = $_GET['var'];
    else $content = null;
    PHP:
     
    revvi, Jul 13, 2008 IP
  3. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #3
    xrvel, Jul 14, 2008 IP