CodeIgniter Forums
need help with cdata in xml - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: need help with cdata in xml (/showthread.php?tid=18826)



need help with cdata in xml - El Forum - 05-19-2009

[eluser]new_igniter[/eluser]
Hello,
I am trying to use longurl.org to reverse a bunch of tiny links

Code:
$urlLink = $somePassedURLthroughFunction;
        $fileProxURL = "http://api.longurl.org/v1/expand?url=$urlLink";
        $data = file_get_contents($fileProxURL);
        $xml = new SimpleXMLElement($data);

        foreach($xml as $item)
        {
            print_r($item);
        }

and getting back

Code:
<response>
    <long_url>&lt;![CDATA[http://bit.ly/dotym]]></long_url>
</response>

How do I fetch the <log_url> value? OR a better question, in PHP what is going on with that?
Why is that <CDATA tag and how do I handle it?