Yet another impossible task? I really need your help guys.

Discussion in 'PHP' started by itsme, Feb 7, 2006.

  1. #1
    Hi all, I have a bit of a problem that I can't seem to solve. I'll try to keep this short and sweet.

    I use a PHP redirect script to hide affiliate links on my websites, simple enough. For the most part it works just fine, but I've recently started to question whether of not I was getting all of the redirects right. (my stats don't match up always)

    It would take way too much time to check each link manually and see if it was redirecting to right place, so I set out to write the script that would solve this problem...

    I need to know if there is ANY way to return the URL that the redirect leads to?

    I can use file_get_contents(myredirect) to request the link/page and it will follow the redirect, returning the contents of the website I am getting redirected to... no problem, but how do I return the URL, not the content?

    I want to use this to generate reports that will print out the redirect URL and the final landing page URL so I can see if it's all in order or if there are broken/erroneous links:

    myURL1 => http ://remotepage1.com
    myURL2 => http ://remotepage2.com
    myURL3 => PAGE NOT FOUND

    PLEASE HELP ME!

    Pete
     
    itsme, Feb 7, 2006 IP
  2. eiso

    eiso Peon

    Messages:
    583
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You might want to look at the php cURL library and then within that use a FOLLOW_LOCATION.
     
    eiso, Feb 7, 2006 IP
  3. itsme

    itsme Well-Known Member

    Messages:
    1,232
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    180
    #3
    I've taken a look at that, I'll look again... thanks.

    In the mean time, if someone actually knows how it can be done, please post a small sample, it would help a lot.
     
    itsme, Feb 7, 2006 IP