Jump to content

XML parser strips html tags


ozby

Recommended Posts

Hi, i am developing little bot that reads rss content, but i have a problem;

 

My code is:

<?php
$contents="http://www.***.com/***/rss?bolumno=101";
$contents = file_get_contents($contents);
$parser = xml_parser_create('');
    xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
    xml_parse_into_struct($parser, trim($contents), $xml_values);
    xml_parser_free($parser);

echo"<pre>";print_r($xml_values);echo"</pre>";
?>

 

When i run it on windows(my home pc) there is no problem it works like:

 

 

 

    [8] => Array
        (
            [tag] => description
            [type] => complete
            [level] => 4
            [value] => <IMG style="border: navy 1px solid;" src="http://***.com/***/2008/11/23/dixon_k.jpg" border="0" align="left" width="80" height="60"/>The future is all about emotion, says internationally renowned futurist and business consultant Patrick Dixon. That&#39;s why business companies need to take into account that money isn&#39;t everything, Dixon explains in an interview with Sunday&#39;s Zaman. Instead of focusing on profits, he advocates a concept called "Happynomics," whose implications go beyond business, according to the expert.
        )

 

but i run it on linux server i lose html tags first and last character (<,>) you can see at below.

 

    [8] => Array
        (
            [tag] => description
            [type] => complete
            [level] => 4
            [value] => IMG style="border: navy 1px solid;" src="http://***.com/***/2008/11/23/dixon_k.jpg" border="0" align="left" width="80" height="60"/The future is all about emotion, says internationally renowned futurist and business consultant Patrick Dixon. That#39;s why business companies need to take into account that money isn#39;t everything, Dixon explains in an interview with Sunday#39;s Zaman. Instead of focusing on profits, he advocates a concept called quot;Happynomics,quot; whose implications go beyond business, according to the expert.
        )

 

how can i pass this problem?

thank you for help.

 

Link to comment
https://forums.phpfreaks.com/topic/133880-xml-parser-strips-html-tags/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.