Page 1 of 1
How can i learn redirected page?
Posted: Sat Dec 06, 2008 2:29 pm
by ozberk
Hi, i have links that redirected to some pages like
http://www.domain.com/redirect.php?id=213
i want to learn page that redirected from this links.
how can i do it?
thank you....
Re: How can i learn redirected page?
Posted: Sat Dec 06, 2008 2:52 pm
by dude81
... but people say, this source is usually not to be trusted
Re: How can i learn redirected page?
Posted: Sat Dec 06, 2008 3:25 pm
by ozberk
no i cant explain clearly sorry....
http://www.domain.com/redirect.php?id=213 =>
http://www.domain2.com/news.php?id=23432
like this and i want to learn this from my web site... my database has link that redirect(domain.com in example), but i want to collect redirected original web site (domain2.com in example.)
Re: How can i learn redirected page?
Posted: Sat Dec 06, 2008 5:46 pm
by requinix
If you use cURL you can find out where you get redirected.
Code: Select all
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_NOBODY, 1);
curl_exec($curl);
$info = curl_getinfo($curl);
echo "Final location: ", $info["url"];
Re: How can i learn redirected page?
Posted: Sun Dec 07, 2008 4:15 am
by semas
Code: Select all
$query = mysql_query("SELECT * FROM links WHERE id=\"{$_GET['redirect']}\""); //sends query t
if(mysql_num_rows($query) > 0){ //checks if there is record in mysql with id typed in url
$row = mysql_fetch_array($query); //add line into array listed by id
mysql_query("UPDATE links SET clicks=clicks+1 WHERE id={$_GET['redirect']}"); //my links has clicks so it updates it
echo " <meta http-equiv=\"REFRESH\" content=\"0;url={$row['link']}\">"; //makes browser redirect to that page with id listed on url
}else {
echo " <meta http-equiv=\"REFRESH\" content=\"0;url=$site_link\">"; //else it redirects to main page
}
Im using this code to redirect
Re: How can i learn redirected page?
Posted: Sun Dec 07, 2008 7:09 am
by greyhoundcode
Just personal preference, but I tend to execute redirects with:
Re: How can i learn redirected page?
Posted: Sun Dec 07, 2008 1:10 pm
by mmj
semas wrote:Code: Select all
$query = mysql_query("SELECT * FROM links WHERE id=\"{$_GET['redirect']}\""); //sends query t
if(mysql_num_rows($query) > 0){ //checks if there is record in mysql with id typed in url
$row = mysql_fetch_array($query); //add line into array listed by id
mysql_query("UPDATE links SET clicks=clicks+1 WHERE id={$_GET['redirect']}"); //my links has clicks so it updates it
echo " <meta http-equiv=\"REFRESH\" content=\"0;url={$row['link']}\">"; //makes browser redirect to that page with id listed on url
}else {
echo " <meta http-equiv=\"REFRESH\" content=\"0;url=$site_link\">"; //else it redirects to main page
}
Im using this code to redirect
greyhoundcode wrote:Just personal preference, but I tend to execute redirects with:
A little from the first post and a little from the second:
Perfect.
