get url from redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
santi
Forum Newbie
Posts: 6
Joined: Sun Jan 23, 2005 1:04 pm

get url from redirect

Post by santi »

Hi
Im trying to get the url or some information
about external site to redirect to my site

I thin that this site use

Code: Select all

header(location "mysite");
becouste I get no value on

Code: Select all

$HTTP_REFERER
;

Its possible get some info about this external site ??

thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$_SERVER['HTTP_REFERER']

however, do not assume it exists or is even valid. It's an optional component of the request headers, and as such may not exist or may be filtered out by something the user is communicating through.
santi
Forum Newbie
Posts: 6
Joined: Sun Jan 23, 2005 1:04 pm

Post by santi »

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it works from here, if I send the referrer information.
santi
Forum Newbie
Posts: 6
Joined: Sun Jan 23, 2005 1:04 pm

Post by santi »

I asum that they no send the referer information
Can I get other information ??

thanks
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

make all the links in your website like this

somepage.php?came_from=path/to/this_page_name.foo



or you can use sessions to pass the last page they viewed


as far as getting where they came from if the last page was not on your website, the only chance is the browsers referrer header, which isnt very reliable
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if they don't provide it.. there's pretty much nothing you can do about it.

A page redirect alone, typically will pass on whatever referrer information was supplied to the first page. In your link, this is the case. Now, if you simply click on your link here, most likely, you will get the referrer information that will say this page.
santi
Forum Newbie
Posts: 6
Joined: Sun Jan 23, 2005 1:04 pm

Post by santi »

Well

but, take a look on url
you click on
http://www.santicabanillas.com.ar/redirect.php

and this redirect to
http://www.arraialdajuda.com/santi/get_redirect.php

Code: Select all

header(location "http://www.arraialdajuda.com/santi/get_redirect.php");
the $_SERVER['HTTP_REFERER'] its OK

but I need to get info about the redirect page that it is inside

1. $_SERVER['HTTP_REFERER'] (where you click)
2. http://www.santicabanillas.com.ar/redirect.php
(I need info about this page)
3. http://www.arraialdajuda.com/santi/get_redirect.php (final page)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use a meta-refresh style redirect then...
santi
Forum Newbie
Posts: 6
Joined: Sun Jan 23, 2005 1:04 pm

Post by santi »

sorry about my english

I dont need redirect
I need get information about the page that do the redirection

some external website do a redirect to my website
and I need to get informacion about this external website
to cancel the redirection

example
you have a domain http://www.xxxx.com
and install an index.php
> http://www.xxxx.com/index.php
header(location "my site");

I need to get info about http://www.xxxx.com to cancel this redirection
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if the information isn't sent, you have no way of knowing.
santi
Forum Newbie
Posts: 6
Joined: Sun Jan 23, 2005 1:04 pm

Post by santi »

Well
very thanks for your time
Post Reply