Jump to content


Photo

redirection and parse_url


  • Please log in to reply
5 replies to this topic

#1 ginocote

ginocote
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 30 August 2006 - 05:33 PM

Hi,

I have this scripts and i want to take the result to redirect to a webpage.

<?php
$url = trim($_GET["url"]);

$a = str_replace('www.', '', parse_url($url));
echo 'Lien vers <a href=http://www.toolurl.com/search-domains.php?url=www.' . $a['host'] .'>'. $a['host'] . '</a>';

?>

this is my test page:
http://scripts.toolu...orums/index.php

many test on this page: the last two result are the good one.
i want to take a full url and redirect it to the www.toolurl.com search: for this example it will redirect to this page: http://www.toolurl.c...w.phpfreaks.com

resume:
when someone will go to: http://scripts.toolu...orums/index.php
he will be automaticly redirect to: http://www.toolurl.c...w.phpfreaks.com

Thank you to help

#2 ginocote

ginocote
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 30 August 2006 - 09:32 PM

Any help for this redirection?

#3 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 30 August 2006 - 10:18 PM

Why don't you make an INDEX.PHP on your
http://scripts.toolu...aks.com/forums/
site and put the following code in:

<?php
header("Location: http://www.toolurl.com/search-domains.php?url=www.phpfreaks.com");
?>

Or do I misunderstand the question?
When you want to break down the url, you can use the parse_url command, see http://nl3.php.net/m...n.parse-url.php

Ronald  8)
RTFM is an almost extinct art form, it should be subsidized.

#4 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 31 August 2006 - 12:50 AM

Use a 301 redirect in .htaccess.

#5 ginocote

ginocote
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 31 August 2006 - 01:14 PM

Why don't you make an INDEX.PHP on your
http://scripts.toolu...aks.com/forums/
site and put the following code in:

<?php
header("Location: http://www.toolurl.com/search-domains.php?url=www.phpfreaks.com");
?>

Or do I misunderstand the question?
When you want to break down the url, you can use the parse_url command, see http://nl3.php.net/m...n.parse-url.php

Ronald  8)


I need a php scripts in this redirection to parse the url for this example:
http://www.phpfreaks...orums/index.php
and transforme it to
www.phpfreaks.com

witch scripts i should use to take my result www.phpfreaks.com and send it to the redirect script?

And the redirect scripts to work should be the first line of a web page, we can send the result www.phpfreaks.com at the beginning of the page.

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 31 August 2006 - 01:42 PM

Is this what you mean.

test.php
<?php
echo"<a href='test_result.php?get=url&url2=http://www.google.com'>go to google</a>";
?>

test_result.php
<?php

if($_GET['get']=="url"){

$url2=$_GET['url2'];

header("location: $url2");

}

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users