How to include PHP in HTML


#1

Hello,

Do you have instruction on how to include php file in html? do I need create a .htaccess file to allow the parser? what is the syntax in .htaccess?

I read the document about using relative path to call the php file, but my include file doesn’t show, I believe .htaccess has to be configured as well?

Thanks.


#2

I use several php files but to keep everything in good format for SEO(search engine optimization) I am using this in my htaccess.

AddType application/x-httpd-php .html

This allows normal html pages run as a php page. And this is to include an outside php file.

<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "YOUR-LINK"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch);?>