Help - Search - Members - Calendar
Full Version: PHP Include/Require Question
Invision Power Services > Community Forums > Community Web Design and Coding
Priest
Hopefully I can explain this correctly:

Ok, I am wanting to load a page while keeping the browser URL the same. In the past I just used frames to load the new page. However, now I am wanting to use PHP to load the page.

Example:
http://www.domain.com/helpdesk/index.php (shows in the browser URL)
However...
http://www.otherdomain.com/helpdesk/index.php?group=support (is what really loads).

I tried this by creating a PHP file with this code inside:
QUOTE
<?php
require("http://www.otherdomain.com/helpdesk/index.php?group=support");
?>

And it works to load the page while not changing to broswer URL, however, when clicking the links on the helpdesk, it doesn't work because it's still focused on the original domain.

So my question is: how can I do this (above) but set the document path so that the browser url stays the same but the entire helpdesk works because even though it's being loaded into a page on http://www.domain.com it knows to pull the source info from: http://www.otherdomain.com

Confused?

(I know what I want it's just hard to explain).

Thanks!
Priest
Brendon Koz
I can't quite remember for sure, but I'm pretty positive that what you want to do requires a server setting, not something that you can do (easily anyway) through just using PHP.

Try looking around for .htaccess commands that might help you out on this. I left my Apache book at work so I have no easy-reading reference material to look at.

If you wanted to use JUST PHP, you'd have to quickly load the page, grab the page URL query through PHP's environment variables, store it in a session/cookie, reload the original page, and then using the info you got previously, require the proper file from the index...or something similar to that.
Priest
I've been looking things up and have started thinking that maybe I can do this with .htaccess also, but my point is that I want to be able to keep the URL the same without showing where they are being redirected, and without using frames.

Thanks,
Priest
Brendon Koz
Yes, I know what you meant and what you wanted. original.gif

The "redirect" that I talked about it usually so quick, the user can't see it. However, I still think .htaccess is your best bet.
Priest
QUOTE(malikyte @ Jul 12 2005, 10:05 PM) *
However, I still think .htaccess is your best bet.

Yes but .htaccess would simply redirect thema nd show the new URL in the browser. It's be the same as using a "onLoad" html command... so that won't work.

sad.gif

I'm not trying to be deceptive.. just trying to redirect my customers to the HelpDesk located on another domain without them noticing. (I've previously received a lot of questions about why they are taken somewhere else.)

Could I create a <table> but pull the source (or data) of that table from somewhere else? How would I do that?

-p-
Brendon Koz
Upon a quick search, the only answers I found were that it was only possible by using frames... I had thought otherwise, but I guess I was mistaken.

...and if done the way I had thought through .htaccess, it would not have shown the new URL in the browser. As I already said, I completely understand what you want. A redirect does not necessarily have to show itself to the user, there are many different types of redirects (i.e.: Server Response type 301 ...although it would definately show a different URL, it's a different type).
phatmonkey
CODE
<?php
echo file_get_contents("http://www.otherdomain.com/helpdesk/index.php?group=support");
?>


However, you will notice major speed problems, since the server has to request the file from the other server. You might have more success caching the remote page to file.
Brendon Koz
phatmonkey,

...depending on the visitors' clicks though, he would have to load different pages - the only way to accomplish something like that, would be to send a query to the server somehow to tell it which remote file to use "file_get_contents" (or any other means) on...so the problem remains.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.