How To Tracking URL Link in other website - php

I want to know how to programming the script for tracking purpose.
Such as I put the link on my blog, and I can know which IP or which website is using my URL Link on their website?
I have a live price url that retrieved from my own database.
E.g. www.example.com/live_price.php
It is only display data in table format, where data are dynamically selecting from my database.
This URL Link exposes to other people put onto their website. Example in iFrame or other method to exactly display the link on website.

In short: you can't.
You can't know which website uses your link because the person hitting the link is the home user, not your website.
A home user hits http://mywebsite.com/ which returns an HTML document containing a link to an image off your website. From your point of view, you just see a user downloading the image off your website. There is no way for you to find out that he heard of the link from http://mywebsite.com/.

In php you can check the value of $_SERVER['HTTP_REFERER'] to see where a user is coming from.

In php you can try $_SERVER vars
Using $_SERVER['REMOTE_ADDR'] you can see the ip of the system from which your site is being addressed.
$_SERVER['HTTP_USER_AGENT'] you can check the user agent .
check for more $_SERVER vars here

Related

How to retrieve an action out of a url in php

I'm making a site where you can book a cabin. One of the requirements was to make a reaction system where an admin gets an e-mail with a link. If he clicks this link, the reaction will be posted on the site. I'm almost done with this, I only have one question:
http://student.waerdenborch.nl/~groep45/site/index.php?reactie=f0357a3f154bc2ffe2bff55055457068
In this link, how can i retrieve the part behind ?reactie=?
I could only find how to retrieve more of the url, but I only want the md5.
Just retrieve it by using $_GET
$_GET['reactie']
Also read this: http://php.net/manual/en/reserved.variables.get.php

Need tp find Request source URL in PHP

I want to determine the website from which the request to the particular website has been called. For Example..I have a website www.ex.com. Now this website link has been there on three websites www.a.com, www.b.com, and www.c.com. Suppose one user has clicked the link from www.a.com to go to www.ex.com. Now I want to determine that the request has come from the www.a.com and then the page in www.ex.com will be displayed accordingly. Similarly if the user has clicked the www.ex.com link from www.b.com then the page will be displayed accordingly.
So how can I determine this request source, means from which website www.ex.com has been called? It is good if you will explain this using code in PHP.
Thanks
Look here for HTTP_HOST and HTTP_REFERER.
Since both global variables are populated from HTTP headers, look also here for Host and Referer.
That's how you use them:
$host = $_SERVER['HTTP_HOST'];
$referer = $_SERVER['HTTP_REFERER'];
The 1st is the original host name (like 'www.a.com') referring to your page. The 2nd is the full URL (like https://www.a.com/some/path/to/some.html).
Then, based on some conditional logic, you may return to your users appropriate HTML.
There are two different websites.
Say from a.com, you click on ex.com
So, for the link in a.com, add some parameter:
Click Here
Now, your from parameter will be
1) a.com
2) b.com
3) c.com
If none of the above, then its clicked from ex.com itself.
You can also add some encryption for this link to add security.
You can use this
$_SERVER['HTTP_REFERER']
for referral url

How can I get Infusionsoft's Cookie Info from this URL

Infusionsoft provides the following script / method of obtaining an affiliate ID. Now, I want to call that URL programmatically and just get back the affiliate ID - I don't want to redirect or go anywhere else, I just want the affiliate ID to use in a following query. I know there has to be a way to do this, but I have no idea what it might be...
--
Here is an example of the modified redirect link URL. You will need to change highlighted sections to enter your Infusionsoft application name and the URL of your destination website.
https://appName.infusionsoft.com/aff.html?to=http://www.example.com
If the prospect clicking on this link has a referral cookie stored on their browser, the partner will land on a page with a URL something like this:
http://www.example.com?affiliate=1234
The destination URL matches the one at the end of the redirect link and the referring partner's ID is part of the URL. If no cookie is found, the referral partner ID number is set to zero.
I think I've looked into doing this before. It seems to me that if you created a page to redirect to, for example, http://www.example.com/affiliateId.php, and on that page you echoed nothing but the affiliate ID, like so:
<?php echo $_GET['affiliate']; ?>
You could simply cURL that page and pull in the response. The problem here is that when you cURL the page, it's actually your server going to the page, and not the user's computer, so it always returns 0.
So, somehow, you need to get the user's computer to navigate to the page, perhaps through the use of an iframe or an ajax call and then pull the information after it's been rendered using a client side script.

How to store Entry URL (Landing URL) and Referring site to a website using jquery/PHP

I want to store the landing page url to my website.
example: when user comes from the google search to http://mysite.com/, He can browse any number of pages But the landing url or entry url will be http://mysite.com/. So i was not able to store this url, but i can able to store the previous url using document.referrer. How to do this in jquery, Do i need to use cookies or Is there any other way.
How to store the referring site, For example if user comes from google search. how to store it, instead of storing the previous URL. Is this can be done using PHP.
Where do you want to store it? If you want to store it in a server-side database, you can you Jquery to call an AJAX function to store it.
Alternatively, you can use PHP using $_SERVER['HTTP_REFERER'].
An other part of your question is how to not store your local pages, you can use regular expression, e.g.
$domain = parse_url($_SERVER['HTTP_REFERER']);
$host = #$domain['host'];
if (!preg_match('/yourwebsite\.com/', $host)){
// Store your url
}
Hope it helps.

php how to find the location where a user came from?

simple question:
how to find the location (url) where a user came from before accessing my page?
and
how to find the location (url) where a user goes after exiting my webpage?
any ideas where i should start?
thanks
In PHP, you can use the $_SERVER['HTTP_REFERER'] to know where the user came from.
There is no mechanism to know where the user is going, unless they clicked a link on your site to leave your page. (If that is the kind of exit that you want to track, you'll need to rely on javascript and implement something like Google Analytics outbound link tracking: http://www.google.com/support/analytics/bin/answer.py?answer=55527)
To the first question:
Usually if someone comes to your page via a link or something like this a HTTP referer entry points to the refering page. See rfc2616
Second question:
If you have a link which links to an external page you may notice this by wrapping these links with some script. If someone types in a page by hand you will not be able to determine the location where the user went.
If the from page and destination pages are made by you, You can send the source page's url within GET or POST method and grab it in the destination and redirect user back to that url.

Categories