In an XML object, data that contains html codes must be placed in a <! [CDATA [* Text *]] block.
The SimpleXMLElement class is extended by the addCData method in the script. With a simple query text! = Strip_tags (text) it is decided whether the value has to be packed into a CDATA block.
The Ampersand (&) is also escaped in this script.
Continue reading “XML record with CDATA values and output”
I had previously always problems with German umlauts in my home projects.
Now I’ve found a way so that there are no more problems with special characters:
The file is not suitable to be accessed via a web browser. It must be started with the command line: “php filename.php” to give the script practically all the time and allow sufficient resources for its execution. In Debian install the tool with: # apt-get install php5-cli. In the directory of the file start it with # php ./filename.php.
You need to lookup the values of the variables ‘post_max_size’ and ‘upload_max_filesize’ in your PHP Configuration (php.ini).
In the example, the lowest value of this 2 variables is taken and displayed in Megabytes:
If you write a PHP script that takes a long time to run, there is the following error message:
Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/xy.php on line xy
For this you have in php.ini (Debian: /etc/php5/apache2/php.ini) set the following values to prevent the error:
max_execution_time = 0;
max_input_time = 0
Restart the server with /etc/init.d/apache2 restart.
In a production environment with public access this configuration is HIGHLY not recommended.