How can I track URL forwarding

Discussion in 'PHP' started by raotnv, Feb 25, 2009.

  1. #1
    Dear All

    Could any body shed some light on my problem. What I am trying to do is I have one URL1 (http://www.domain1.com) and user click this url1 and which redirects to URL2 (http://www.domain2.com). But my problem here is I know what could be URL1 but never know URL2 which I need to track for some encoded strings in url they append when they loaded. Is there any way I can track the final forwarded URL in php?. or even java script also fine for me if you have some ideas.

    I tried below solution but no luck.

    $ch = curl_init($url);
    $execute = curl_exec($ch);
    if(!curl_errno($ch))
    {
    $stringData = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
    }

    Appreciate your help in advance.

    Thanks
    Rao
     
    raotnv, Feb 25, 2009 IP
  2. ebizaustralia

    ebizaustralia Peon

    Messages:
    91
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    from where is this url2 fetched?
     
    ebizaustralia, Feb 25, 2009 IP
  3. raotnv

    raotnv Peon

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Url1 forwards to url2 which I never know and it is dynamic. What I have is URL1 is only.
     
    raotnv, Mar 3, 2009 IP