Results 1 to 5 of 5

 

Thread: Php Redirect trouble

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Jan 2005
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post


    Hi,

    I'm trying to write a simple redirect script.

    Example url:
    go.php?to=http://www.awin1.com/pclick.php?p=123&a=123&m=123

    Script:
    $link = $_GET['to'];
    header("location:$link");

    The GET only gets up till http://www.awin1.com/pclick.php?p=123

    How can I get the whole link?

    Thanks

  2. #2
    lowndsy's Avatar
    Dark Prince

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Behind you
    Posts
    1,824
    Thanks
    7
    Thanked 44 Times in 33 Posts
    This is because you haven't url encoded the redirect url - the script sees each variable as a seperate entity, so "&a=123&m=123" would be in two further variables called a and m.

    You can do two things. Either urlencode the web address before you pass it to the sscript so it doesn't get cut up, or have a seperate loop in the script to construct the entire address from the whole $_GET value.
    Affiliate Partnership Manager - Kidstart

  3. #3
    Typing with both fingers.

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Allt Y Coed Farm, North Pembrokeshire
    Posts
    4,123
    Thanks
    247
    Thanked 198 Times in 157 Posts
    If your still stuck this is the page on php.net you need to look at to find and use the function:-

    PHP: urlencode - Manual

    Ta

    Baz

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Jan 2005
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by lowndsy View Post
    This is because you haven't url encoded the redirect url - the script sees each variable as a seperate entity, so "&a=123&m=123" would be in two further variables called a and m.

    You can do two things. Either urlencode the web address before you pass it to the sscript so it doesn't get cut up, or have a seperate loop in the script to construct the entire address from the whole $_GET value.
    Thanks lowndsy,

    urlencode did the trick.

    Cheers,

    Nicky

  5. #5
    Registered User

    Status
    Offline
    Join Date
    Jan 2005
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post
    Cheers Barry



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Passing Keyword Data Thru php Redirect Links?
    By KirstyM in forum Programming
    Replies: 1
    Last Post: 23-04-08, 09:56 AM
  2. Php redirect script
    By madeinbritain in forum Affiliate Marketing Lounge
    Replies: 21
    Last Post: 05-03-08, 03:26 PM
  3. Will I get blacklisted for using a php redirect script?
    By m-a-hudson in forum Programming
    Replies: 2
    Last Post: 04-07-06, 04:28 PM
  4. PHP Redirect
    By uklejon in forum Programming
    Replies: 3
    Last Post: 07-09-05, 01:34 PM
  5. PHP redirect question
    By drivetowin in forum Programming
    Replies: 1
    Last Post: 31-12-04, 03:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2