tags:

views:

164

answers:

4

Having just written the title for this question I am aware of how dodgy it sounds!

I am writing a back end for storing volunteer information for some friends, they have their own website to which I can add a volunteer.php page.

What I want is for that page to redirect to a page on my server showing the form for the users to fill in, I would prefer the ugly URL of my site not to show.

Is there an easy way to do this? Load the page inside the remotely hosted page somehow?

Thanks,

Gav

+2  A: 

You could use an <IFRAME> to show the contents of your sites page without showing the url.

Josh K
+1  A: 

I'm assuming that you only want to hide the URL for "ugly URL" reasons, and not security ("what else is on this domain?") or bandwidth reasons). Some possible solutions...

  • Load your form via an iframe. Of course, if the user is at all technically inclined they'll be able to view the iframe's source and get your ugly URL.

  • Use a reverse proxy. This will sufficiently hide your server.

  • Have your application code load in the contents of your remote file, and then output them onto the page. See file_get_contents().

Just remember: do you really want your friends taking up your server's bandwidth?

Sam Bisbee
file_get_contents will get a little involved when submitting data back to the page. Either the simple 'load' script on the public server gets way more complex than a simple function call, or you end up submitting data directly to the 'hidden' server, then maybe redirecting to the 'public' page again.
Tim Lytle
Sorry, maybe I wasn't quite clear enough. You'd output the contents into the "local server", not the "remote server" that you're loading the script from. So, when it's compiled, you could provide either the remote location or `$_SERVER['PHP_SELF'];`. He's most likely sending form results to his own, "remote", server anyways.
Sam Bisbee
A: 

The easy way is to use an iframe, as Josh K said. The elegant way is to generate the form in volunteer.php and have it sent to your server via AJAX so that the visitor never needs to leave their site. Iframes tend to mess up navigation.

Tgr
+1  A: 

mod_rewrite could be used, if their server supports using the [P] (proxy flag):

^/volunteer.php http://yourserver/volunteer.php?id=siteid [P]

Something like that also makes it easy to tell which form you're serving.

Tim Lytle
Nice, I didn't know about this at all. Unfortunately the maintainer for the other site is on hiatus and I have permission to add one file, it's a politics thing but I'd rather stick to what he said.
gav
In that case I'd go with the AJAXy method. Or the iframe.
Tim Lytle