PDA

View Full Version : cURL, embed PHP into HTML



TrafficProducer
01-29-2008, 10:16 AM
Embeded PHP in HTML refuses to display. A direct PHP call functions.

HTML with Embeded PHP does not display (http://www.acomputerportal.com/test_php.html)

A direct PHP call functions (http://www.acomputerportal.com/test_php.php)

I've tried various .htaccess, using AddType application/x-httpd-php .htm .html at this time

and various httpd.conf, this is blank for PHP at this time.

My new host say it is using cURL because of security, (Is it this is causing problems).

So how, easy way please, I get PHP to display embeded withing HTML pages?

Any help, gratefully received :smile:

DaveSawers
01-30-2008, 08:10 AM
You have to rename the page to use the .php extension. It doesn't matter if the content is mostly (or even all) HTML.

So rename your test_php.html to test_php.php and it'll work just fine.

TrafficProducer
01-30-2008, 08:21 AM
The issue I want .html (with PHP in them)

I just think this is more user, (and maybe search engine), frendly :)

Thany You :)

wige
01-30-2008, 09:59 AM
Because of cURL, I think you need to use AddHandler, instead of just AddType. AddType changes the MIME type of the document, and the server should process the document according to that new MIME type. Because the MIME type does change, this is not the issue. The issue is that the server doesn't know what to do with a document of type application/x-httpd-php, so it simply serves the document to the client. AddHandler creates a specific link between the file extension and the script handler. I would still recommend trying the following:

AddHandler php5-script .html

TrafficProducer
01-30-2008, 10:50 AM
I've triesd a few AddHandler ... but no joy. I'm looking for a different host, (yet again)

Have tried:-

AddHandler x-httpd-php .html .htm

AddHandler php5-script .html

Thank you

DaveSawers
01-30-2008, 03:36 PM
I just think this is more user, (and maybe search engine), frendly :)

Really? Why?

carbonize
02-04-2008, 10:21 PM
The extension of your web page makes no difference to neither your users nor search engines. If the php scripts you are trying to include are on your site then I recommend using include or require over cURL as they put less demand on the resources and are faster.

TrafficProducer
02-05-2008, 06:18 AM
I've moved to a better host, without these issues.

Thanks everyone :)