Forum Moderators: coopster
Essentially the headers and footers for a page will come from the main domain, but I then want to run a PHP script that resides on a different domain, actually a different host altogether. The main domain has Perl as its main scripting language.
My questions are:
1. How can I include the output of the remote PHP script in my HTML pages, when I have only HTML and perl available on the main domain?
2. What pitfalls are there to doing this?
3. Is this considered a 'no-no' in terms of security or privacy?
Thanks.
I'll get the ball rolling here - interesting situation you have :)
1) Yes - you can use libwww-perl to go off and get pages, and include them in your output. More details here: [linpro.no...] also check out CPAN for more options...
2) You are dependent on two hosts to produce one page, content duplication, submiting forms ... lots of them.
3) Really depends what you're doing - one example - if you are running over https and then use a non secure connection from your main site then the benefits of encryption would be lost. (plus you're on an NT server ;) )
It depends so much on the specifics of your project here:
If you are running a content driven site that has little or no user customisation I would suggest a different approach - run the entire site on a php enabled server (not necessarily publicly accessible), spider it - grab all the outputted html and host that on your win-NT server as a static site.
You should get plenty more ideas soon - good luck
Use the external javascript call in your html to run the php script on the remote server:
<script language="javascript" src="http://www.domain.com/whatever.php"> </script>
... and use the write method of the document object to return the output from whatever.php:
<?
echo "document.write('IP: $REMOTE_ADDR / Linked from: $HTTP_REFERER / UA: $HTTP_USER_AGENT');";
?>
... the sample is a tracking method - IP, etc. - but you can "write" whatever you like. Take care you don't mix up the two languages. Escape where necessary.
Best of luck!
T