Run a PHP script in a .net page
Strange question I know, but I'm developing a .net site, it's going to be pretty big so I'm not developing it in a language I am unfamiliar with (PHP).
The site needs to have it's PHPBB forum ported with it. I've looked at some .net forums but none are to the levels of maturity that the site requires.
Is it possible to somehow run a PHP script (the forum) in 开发者_如何学编程a .net page? I know the obvious answer is no don't be so stupid but just asking incase.
Some of the content on every page will be dynamically generated by .net and I'd rather not write all these template headers/footers in .net and PHP so they appear on each page correctly.
One possible solution I thought of was to request the forum php page somehow and print the returned HTML?
You can certainly run PHP on a IIS server, not sure which version you're using but I found that on 7.5 it's real easy to just use Microsoft Web Platform Installer which will not only install PHP for you (Type php in the search bar) but also supports auto-install of a bunch of open source PHP-based web apps. including PHPBB top of the list here... If you then turn around and do includes of the .NET headers/footers, the server will still compile the .NET parts as .NET and the PHP will simply include the parsed files.
You could use the HttpWebRequest object to get the guts of the resultant page, but you'll run into problems in the functionality of the page since the .Net page running it all will not support the php calls natively. You would probably be better of using an iframe with some JavaScript to dynamically size the iframe window so as not to give the appearance of having an iframe present.
精彩评论