Jump to content

Archived

This topic is now archived and is closed to further replies.

ginocote

redirection and parse_url

Recommended Posts

Hi,

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

[code]<?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>';

?>[/code]

this is my test page:
http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/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.com/search-domains.php?url=www.phpfreaks.com

resume:
when someone will go to: http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/index.php
he will be automaticly redirect to: http://www.toolurl.com/search-domains.php?url=www.phpfreaks.com

Thank you to help

Share this post


Link to post
Share on other sites
Why don't you make an INDEX.PHP on your
[url=http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/]http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/[/url]
site and put the following code in:

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

Or do I misunderstand the question?
When you want to break down the url, you can use the parse_url command, see [url=http://nl3.php.net/manual/en/function.parse-url.php]http://nl3.php.net/manual/en/function.parse-url.php[/url]

Ronald  8)

Share this post


Link to post
Share on other sites
[quote author=ronverdonk link=topic=106289.msg425044#msg425044 date=1156976318]
Why don't you make an INDEX.PHP on your
[url=http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/]http://scripts.toolurl.com/parseurl/parse_url.php?url=http://www.phpfreaks.com/forums/[/url]
site and put the following code in:

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

Or do I misunderstand the question?
When you want to break down the url, you can use the parse_url command, see [url=http://nl3.php.net/manual/en/function.parse-url.php]http://nl3.php.net/manual/en/function.parse-url.php[/url]

Ronald  8)
[/quote]

I need a php scripts in this redirection to parse the url for this example:
http://www.phpfreaks.com/forums/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.

Share this post


Link to post
Share on other sites
Is this what you mean.

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

test_result.php
[code]
<?php

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

$url2=$_GET['url2'];

header("location: $url2");

}

?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.