Does any of you know how to mask a URL in php?? Like the one you see in free URL redirectional services

I mean I have a url like http://www.my-server.com/

which will redirect me to http://www.some-other-server.com/abc.php


by the following PHP command

header("location: http://www.some-other-server.com/abc.php");

But I want the URL in the address bar of my browser to show only this URL

http://www.my-server.com/

Is this possible??

`

You'll need to use frames for that.

Personally, I don't like the idea of what you're proposing. IE has (had?) a bug where it will spoof the address so it looks like your page is coming from a legitimate site when really it's coming from a phishing site.

Yes, you can use frames to accomplish the task, but be forewarned that they can annoy your users enough that they never return. I HATE clicking a link and getting trapped in someone's frames.

hi,
yes it is possible.....

just try this script at your default.php page.. it might be work......

<?php
if (getenv ("HTTP_HOST" )==" www.lab1.com" or
getenv (" HTTP_HOST" )==" www.lab2.com" ) {
header(" Location: http://www.lablockers.com/labweb/default.htm" );
exit;
}

?>


Does any of you know how to mask a URL in php?? Like the one you see in free URL redirectional services

I mean I have a url like http://www.my-server.com/

which will redirect me to http://www.some-other-server.com/abc.php


by the following PHP command

header("location: http://www.some-other-server.com/abc.php");

But I want the URL in the address bar of my browser to show only this URL

http://www.my-server.com/

Is this possible??

`

<?php
if (getenv ("HTTP_HOST" )==" www.lab1.com" or
getenv (" HTTP_HOST" )==" www.lab2.com" ) {
header(" Location: http://www.lablockers.com/labweb/default.htm" );
exit;
}
?>
or you can use frame to do that ..


<frameset rows="*,*">
<frame name="header" scrolling="no" noresize target="main" src="traffic2.php?user=41393&displayedsite=21343&newlastsite=64&newurl=http://www.dragonsky.com.cn/emoney.htm">
<frame name="main" src="http://www.dragonsky.com.cn/emoney.htm">

<noframes>
<body>

<p>This page uses frames, but your browser doesn't support them.</p>

</body>
</noframes>
</frameset>


or u can use .htaccessdoc for this url passing
http://www.freewebmasterhelp.com/tutorials/htaccess

Since you have post it in PHP section, we should at least do it in PHP way :cheesy:
If the content of other site is store within the same folder, you can use include function to get the content to display. If the content is from other website, then get the permission first then do the following

$crawl = 'http://www.domain.com/target_page.html';
$fd = fopen($crawl, "r");
while($buf = fgets($fd,1024))
{
echo $buf;
}
fclose($fd);

You may have broken link of images and links, but since you know the url, you can do some trick in your program to overcome it. For example, having a line at the beginning of the page with HTML <base ...>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.