Forum Moderators: coopster

Message Too Old, No Replies

Query From a URL

Extracting the query from a URL

         

nedloh

6:26 am on Jul 16, 2007 (gmt 0)

10+ Year Member



I want to extract the query from a URL as it will show the site that i was visited from(a script i have made) E.G The link will be mysite.com/referer.php?=refer link
Is there a possible way to do this? I was going to use the parse function but i couldn't get it to output just the query. I need it to also output to output it as a function. So i can have "you came from "affiliatewebsitehere" Any help :S

Habtom

6:38 am on Jul 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mysite.com/referer.php?=refer link

There are possibly two ways of doing this:
getenv('HTTP_REFERER'); to get the last URL

OR

the URLs leading them to the site should have

mysite.com/index.php?referer=somelink
then you can get the Referer as:

$_REQUEST['referer'];

Habtom

6:40 am on Jul 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Btw nedloh, welcome to WebmasterWorld.

Hab

nedloh

7:05 am on Jul 16, 2007 (gmt 0)

10+ Year Member



lol, THanks ;)
This is the code i have
<p>You were refered by:<b><?php $_REQUEST['referer'];?></b><br><table width="500" height="325" cellpadding="5" cellspacing="0"
I would and it just outputs "You were refered by"
And i would be using this with other parts of my site not just referer.
Any other ideas?
(thanks for saying hi and thanks for the help ;) good to see such a great comunity!)

[edited by: nedloh at 7:07 am (utc) on July 16, 2007]

nedloh

7:06 am on Jul 16, 2007 (gmt 0)

10+ Year Member



i would be using this for the download aswell. E.G You are downloading: "name after query here"

Habtom

7:11 am on Jul 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<p>You were refered by:<b><?php $_REQUEST['referer'];?></b><br><table width="500" height="325" cellpadding="5" cellspacing="0"

<p>You were refered by:<b><?php echo getenv('HTTP_REFERER');?></b>
. . . .

If you have the list of the sites refering to you, you need to save them in the database and show more friendly URLs or Websites.

Try the above, though.

nedloh

7:23 am on Jul 16, 2007 (gmt 0)

10+ Year Member



Thanks, Testing now. I only want to see where my hits are coming from. i don't have an affiliate thing yet, When i start to get a bit better i might add a affiliat, But for the time being, it should be right. Thanks anyways. Will update with progress in a minute ;)

nedloh

7:27 am on Jul 16, 2007 (gmt 0)

10+ Year Member



No, Meh, Dw about it. Il figure something out. Thanks for the help anyway.