Combining PHP and ASP - can it be done?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gcapp
Forum Newbie
Posts: 14
Joined: Thu Jun 01, 2006 8:59 am

Combining PHP and ASP - can it be done?

Post by gcapp »

Hello - I am new to using PHP. I have coded in ASP for years.

I have a simple question.

I have an ASP page that displays data from an Access database. Works perfect. This ASP page has a few "include file" tags like this:
<!-- #include file="inc-page2.asp" -->

So the main ASP page is called index.asp. This page has two include file tags, which are:
<!-- #include file="inc-page2.asp" -->
<!-- #include file="inc-page3.asp" -->

The inc-page2.asp page has the code that extracts the info from the Access database.

So if I create PHP code to extract information from the MySQL database that I have, can that PHP page be substituted for the inc-page2.asp page, so the tag would be: <!-- #include file="inc-page2.php -->

I don't know if you can combine asp and php code.

I have tried combining the two types of code but all that shows on my index.asp is the actual PHP code where the data from the MySQL database should be. So I wasn't sure if it is possible.

Any info on this matter would be appreciated.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Combining PHP and ASP - can it be done?

Post by Celauran »

I wouldn't expect it could be done directly as an include. However, you could always create a simple API on the PHP/MySQL end that your ASP site consumes. Though, what is it you're trying to do? Can ASP not connect to the MySQL database directly?
gcapp
Forum Newbie
Posts: 14
Joined: Thu Jun 01, 2006 8:59 am

Re: Combining PHP and ASP - can it be done?

Post by gcapp »

Nevermind. Sorry for the post - I found out that you can't use include file tags on a php page. Thank you anyway
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Combining PHP and ASP - can it be done?

Post by Christopher »

gcapp wrote:Nevermind. Sorry for the post - I found out that you can't use include file tags on a php page. Thank you anyway
That does not mean you cannot include the output of these files in a PHP file. If you really don't want to recode them, you could run them on the command line and capture the out but from a PHP page.
(#10850)
Post Reply