Redirect script need help

Discussion in 'PHP' started by tomcromp, Mar 29, 2010.

  1. #1
    tomcromp, Mar 29, 2010 IP
  2. K.Meier

    K.Meier Well-Known Member

    Messages:
    281
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    110
    #2
    K.Meier, Mar 29, 2010 IP
  3. tomcromp

    tomcromp Active Member

    Messages:
    454
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #3
    tomcromp, Mar 29, 2010 IP
  4. K.Meier

    K.Meier Well-Known Member

    Messages:
    281
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    110
    #4
    K.Meier, Mar 29, 2010 IP
  5. Fervid

    Fervid Well-Known Member

    Messages:
    161
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    120
    #5
    What is it that you're trying to do? Are you scraping links from another site or are you trying to write a script to redirect traffic?
     
    Fervid, Mar 29, 2010 IP
  6. tomcromp

    tomcromp Active Member

    Messages:
    454
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Right i already have the links scaped you can see at e2tv.tv/ft.php but the links link to /validate/dir.php?http://tv3.us-sport.info/ so how would i create a dir.php to direct to the url without the loc=

    Cheers
    Tom
     
    tomcromp, Mar 29, 2010 IP
  7. ThomasTwen

    ThomasTwen Peon

    Messages:
    113
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    It's a little more challenging

    
    <?php
    $count = 0;
    foreach($_GET as $var => $val) {
    $link = $var;
    $count++;
    }
    if ($count == 1) {
    header("location: " . $link);
    } else {
    echo "An error occured!";
    }
    ?>
    
    PHP:
    untested, and probably not the most elegant solution, but it'll work.
     
    ThomasTwen, Mar 29, 2010 IP
  8. tomcromp

    tomcromp Active Member

    Messages:
    454
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
  9. K.Meier

    K.Meier Well-Known Member

    Messages:
    281
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    110
    #9
    Ah! Now I understand what you want ;)
    
    <?php
    header("location: ".$_SERVER["QUERY_STRING"]."");
    ?>
    PHP:
     
    K.Meier, Mar 29, 2010 IP
  10. tomcromp

    tomcromp Active Member

    Messages:
    454
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #10
    thanks alot works great :D
     
    tomcromp, Mar 29, 2010 IP