how to parse part of url then insert into rest of the links?

Discussion in 'PHP' started by pood, Oct 9, 2006.

  1. #1
    I'm trying to build a little script that does that following...

    Affiliate has an url like this: http://www.site.com/pro.php?id=123

    rip the the 123, save it into a variable.

    insert that variable to all the links on the page.

    can someone help me write that? I haven't programmed anything for years, the last language I learned asp and I pretty much forgot all of it. This should be incredibly easy though, right?

    thanks
     
    pood, Oct 9, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    No need to 'rip' it.

    
    $aff_id = $_GET['id'];
    
    $unprepared_link = "http://www.yoursite.com/home.html";
    $prepared_link = $unprepared_link . '?id=' . $aff_id;
    
    PHP:
     
    T0PS3O, Oct 9, 2006 IP
  3. pood

    pood Active Member

    Messages:
    212
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #3
    thanks a ton!
     
    pood, Oct 9, 2006 IP