17Feb/08
This blog has been neglected due to the success of Solidshops.com
capture the encoding from the main XML file tag
To capture the encoding from the XML tag of the file. We need to read the first line, and pass it to the function to capture the encoding value.
The first line looks like this:
< ?xml version="1.0" encoding="utf-8"? >
The PHP code:
PHP:
function readfirstline($file){ return $firstline; } function get_attr( $line ,$attr) { return $arr_enc [1]; } $path = "home/user/feeds/id.xml"; $line= readfirstline($path);
Popularity: 4% [?]


