1, December 2008

final destination of a link - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: final destination of a link
« previous next »
Pages: [1] Print

Author Topic: final destination of a link  (Read 563 times)
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« on: Dec 15, 2006, 10:50:07 PM »

Is it possible to retrieve the destination of a link, when it gets redirected? Many affiliate programs use a 3rd party to pay the affiliates. To track sales the promotion of the product links to the 3rd party website.
For instance: a link would point to www.3rdpartyprocessor.com/productId/myAffiliateId Visit through proxy when someone clicks the link they will end up at: www.producthomepage.com Visit through proxy
Is there any way I can retrieve the second URL when I only know the first one?


Last blog : Are You Stumbling Yet?
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #1 on: Dec 15, 2006, 11:00:03 PM »

I just found out that a download with cURL will download the content of the second URL. how to download a file with cURL and php Visit through proxy
If I look thru the downloaded source I can see from which page it is, but this is because the page I retrieved contains some images coded as: src="http://www.domain.com/images/image.gif Visit through proxy"
Surely a lot of pages retrieved will not contain the domain name in the code but just use: /images/image.gif so my problem has not been solved yet...


Last blog : Are You Stumbling Yet?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6479
39706 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Dec 16, 2006, 01:04:40 AM »

Quote
Surely a lot of pages retrieved will not contain the domain name in the code but just use: /images/image.gif so my problem has not been solved yet...

with curl it's possible to retrieve a complete bunch of headers, check curl_getinfo()


Last blog : Just a better Internet portal provided by Google
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #3 on: Dec 16, 2006, 01:18:48 AM »

That is exactly what I was looking for!
Code:
curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);

just before the
Code:
curl_close($ch);

shows the URL I'm looking for.

Thanks man!


Last blog : Are You Stumbling Yet?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6479
39706 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Dec 16, 2006, 01:25:26 AM »

Cheesy


Last blog : Just a better Internet portal provided by Google
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8266
42583 credits
Members referred : 3



« Reply #5 on: Dec 16, 2006, 01:37:30 AM »

This may also be useful :

curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);

It will follow all the Location headers.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #6 on: Dec 16, 2006, 02:19:28 AM »

sounds like that could be used as well.


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8266
42583 credits
Members referred : 3



« Reply #7 on: Dec 16, 2006, 12:58:13 PM »

Yeah, this will follow all the redirections, and then with the curl_info you can check which was the final destination.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=5251
Tags : redirect php Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: final destination of a link
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Dec 01, 2008, 11:13:17 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.937
Total Topics: 7.679
Total Members: 4.443
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: mayabiotech

33 Guests, 3 Users online :

12 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.