Re: PHP within XML?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Ron Piggott <ron.piggott@xxxxxxxxxxxxxxxxxx>:


I am trying to figure out if it is possible to have PHP work within an XML document.

The application is tracking RSS subscribers IP addresses within the database.

I have wrote functions so the PHP code required is below is minimal, after the XML declaration line.

Prior to posting this question I tried to have the PHP at the very start, but that doesn’t work, the declaration line needs to be first.

Right now the PHP is displayed as a comment.

In order for your PHP code to be processed the file should be named with a .php extension. Since you're writing XML code, you need to send an XML header type first:
<?php
header ("Content-Type:text/xml");

#load RSS XML function

require_once("rss_subscribers_xml.php");

$ip_address = _ip;
rss_subscriber_update($ip_address);

echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
?>
Rest of your XML content.


This should work.

Ken


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux