Blank CDATA with PHP and SimpleXML - simplexml_load_string
« Return to ArticleRequest
$url = 'http://www.devshed.com/rss-feeds-11.xml';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
// Execute, close connection
$curl_result = curl_exec($ch);
curl_close($ch);
$xml = simplexml_load_string($curl_result, 'SimpleXMLElement', LIBXML_NOCDATA);
print_r($xml);
Response
SimpleXMLElement Object
(
[@attributes] => Array
(
[version] => 2.0
)
[channel] => SimpleXMLElement Object
(
[title] => PHP - Web Developer Tutorials
[link] => Array
(
[0] => http://www.devshed.com
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => hub
[href] => http://devshednet.superfeedr.com/
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[rel] => self
[href] => http://www.devshed.com/rss-feeds-11.xml
)
)
)
[comment] => Array
(
[0] => SimpleXMLElement Object
(
)
[1] => SimpleXMLElement Object
(
)
)
[description] => PHP Tutorials at Dev Shed. DevShed is a community focused on both beginner and advanced tutorials in Java, C, PHP, Python, MySQL and Ruby-on-rails...amongst others.
[language] => en-us
[lastBuildDate] => Thu, 09 Feb 2012 05:02:17 -0500
[pubDate] => Thu, 09 Feb 2012 05:02:17 -0500
[item] => Array
(
[0] => SimpleXMLElement Object
(
[title] => PHP Closures as View Helpers: Lazy-Loading File Data
[pubDate] => Mon, 30 Jan 2012 08:00:07 -0500
[link] => http://www.devshed.com/c/a/PHP/PHP-Closures-as-View-Helpers-LazyLoading-File-Data/
[description] => In this second part of a two-part tutorial, you'll learn how to use closures in the development of an extendable template system. This system can be customized at will without struggling too much, thanks to the number of interfaces that it implements.
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/PHP-Closures-as-View-Helpers-LazyLoading-File-Data/
)
[1] => SimpleXMLElement Object
(
[title] => Using PHP Closures as View Helpers
[pubDate] => Tue, 24 Jan 2012 11:06:09 -0500
[link] => http://www.devshed.com/c/a/PHP/Using-PHP-Closures-as-View-Helpers/
[description] => In this first part of a two-part tutorial, I develop a basic template system that can parse any type of closure assigned as a property of its view object(s).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/Using-PHP-Closures-as-View-Helpers/
)
[2] => SimpleXMLElement Object
(
[title] => PHP File and Operating System Program Execution Functions
[pubDate] => Tue, 03 Jan 2012 12:00:04 -0500
[link] => http://www.devshed.com/c/a/PHP/PHP-File-and-Operating-System-Program-Execution-Functions/
[description] => In this conclusion to an eight-part article series on working with a computer's file and operating system with PHP, you'll learn about the functions used in combination with a PHP script to execute system-level programs. This article is excerpted from chapter 10 of the book Beginning PHP and PostgreSQL 8: From Novice to Professional, written by W. Jason Gilmore and Robert H. Treat (Apress; ISBN: 1590595475).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/PHP-File-and-Operating-System-Program-Execution-Functions/
)
[3] => SimpleXMLElement Object
(
[title] => PHP: Effects of Wrapping Code in Class Constructs
[pubDate] => Wed, 28 Dec 2011 08:00:06 -0500
[link] => http://www.devshed.com/c/a/PHP/PHP-Effects-of-Wrapping-Code-in-Class-Constructs/
[description] => In this first part of a two-part tutorial, I use a somewhat contrived example to show why you should avoid coding static helper classes in PHP.
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/PHP-Effects-of-Wrapping-Code-in-Class-Constructs/
)
[4] => SimpleXMLElement Object
(
[title] => PHP: Building Concrete Validators
[pubDate] => Wed, 21 Dec 2011 08:00:05 -0500
[link] => http://www.devshed.com/c/a/PHP/PHP-Building-Concrete-Validators/
[description] => In this two-part tutorial, I show why the use of static helper classes can be detrimental to building robust and scalable object-oriented applications in PHP (though you should take into account that the concept is language agnostic). I also implement a set of instantiable, fine-grained validators, which can be easily tested in isolation, injected into the internals of other objects, and so forth.
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/PHP-Building-Concrete-Validators/
)
[5] => SimpleXMLElement Object
(
[title] => Sanitizing Input with PHP
[pubDate] => Mon, 12 Dec 2011 11:30:05 -0500
[link] => http://www.devshed.com/c/a/PHP/Sanitizing-Input-with-PHP/
[description] => In this seventh part of an eight-part article series on using PHP commands with your file and operating systems, you'll learn how and why to sanitize user input. This article is excerpted from chapter 10 of the book Beginning PHP and PostgreSQL 8: From Novice to Professional, written by W. Jason Gilmore and Robert H. Treat (Apress; ISBN: 1590595475).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/Sanitizing-Input-with-PHP/
)
[6] => SimpleXMLElement Object
(
[title] => Executing Shell Commands with PHP
[pubDate] => Wed, 07 Dec 2011 09:30:04 -0500
[link] => http://www.devshed.com/c/a/PHP/Executing-Shell-Commands-with-PHP/
[description] => In this sixth part of an eight-part series on working with the file and operating systems of a computer with PHP, you'll learn how to use PHP to write to a file and how to execute shell commands. This article is excerpted from chapter 10 of the book Beginning PHP and PostgreSQL 8: From Novice to Professional, written by W. Jason Gilmore and Robert H. Treat (Apress; ISBN: 1590595475).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/Executing-Shell-Commands-with-PHP/
)
[7] => SimpleXMLElement Object
(
[title] => Handling File Data with PHP
[pubDate] => Tue, 29 Nov 2011 08:00:06 -0500
[link] => http://www.devshed.com/c/a/PHP/Handling-File-Data-with-PHP/
[description] => In this fifth part of an eight-part series on working with file and operating systems with PHP, you'll learn how to read data from a file and move the file pointer. This article is excerpted from chapter 10 of the book Beginning PHP and PostgreSQL 8: From Novice to Professional, written by W. Jason Gilmore and Robert H. Treat (Apress; ISBN: 1590595475).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/Handling-File-Data-with-PHP/
)
[8] => SimpleXMLElement Object
(
[title] => File Security and Resources with PHP
[pubDate] => Wed, 23 Nov 2011 10:00:07 -0500
[link] => http://www.devshed.com/c/a/PHP/File-Security-and-Resources-with-PHP/
[description] => In this fourth part of an article series on working with the file and operating systems with PHP, you'll learn about file ownership and permissions, and the concept of a resource. This article is excerpted from chapter 10 of the book Beginning PHP and PostgreSQL 8: From Novice to Professional, written by W. Jason Gilmore and Robert H. Treat (Apress; ISBN: 1590595475).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/File-Security-and-Resources-with-PHP/
)
[9] => SimpleXMLElement Object
(
[title] => ArrayObject PHP Class Examples
[pubDate] => Wed, 16 Nov 2011 13:00:05 -0500
[link] => http://www.devshed.com/c/a/PHP/ArrayObject-PHP-Class-Examples/
[description] => In this second part of a two-part series on the ArrayObject class from the Standard PHP Library, you'll learn how to handle properties by means of an object syntax.
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/ArrayObject-PHP-Class-Examples/
)
[10] => SimpleXMLElement Object
(
[title] => ArrayObject PHP Class: An Introduction
[pubDate] => Wed, 16 Nov 2011 12:30:06 -0500
[link] => http://www.devshed.com/c/a/PHP/ArrayObject-PHP-Class-An-Introduction/
[description] => In this first part of a two-part tutorial, I demonstrate how simple it is to use the ArrayObject SPL class. This class permits you to easily access properties through an array syntax.
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/ArrayObject-PHP-Class-An-Introduction/
)
[11] => SimpleXMLElement Object
(
[title] => Getting File System Data with PHP
[pubDate] => Tue, 15 Nov 2011 08:00:06 -0500
[link] => http://www.devshed.com/c/a/PHP/Getting-File-System-Data-with-PHP/
[description] => In this third part of an eight-part article series on using PHP to work with the file and operating system, you'll learn how to retrieve the size of a directory and find out a file's last access and modification times. This article is excerpted from chapter 10 of the book Beginning PHP and PostgreSQL 8: From Novice to Professional, written by W. Jason Gilmore and Robert H. Treat (Apress; ISBN: 1590595475).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/Getting-File-System-Data-with-PHP/
)
[12] => SimpleXMLElement Object
(
[title] => PHP Tools for Working with the File and Operating System
[pubDate] => Wed, 09 Nov 2011 12:00:07 -0500
[link] => http://www.devshed.com/c/a/PHP/PHP-Tools-for-Working-with-the-File-and-Operating-System/
[description] => In this second part of an eight-part article series on the tools PHP provides for working with the file system and operating system, we'll go over file types, links, and how to calculate file, directory and disk sizes. This article is excerpted from chapter 10 of the book Beginning PHP and PostgreSQL 8: From Novice to Professional, written by W. Jason Gilmore and Robert H. Treat (Apress; ISBN: 1590595475).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/PHP-Tools-for-Working-with-the-File-and-Operating-System/
)
[13] => SimpleXMLElement Object
(
[title] => Working with the File and Operating System with PHP
[pubDate] => Fri, 04 Nov 2011 08:30:05 -0400
[link] => http://www.devshed.com/c/a/PHP/Working-with-the-File-and-Operating-System-with-PHP/
[description] => PHP as a language offers the programmer an excellent array of tools for handling file system input and output, as well as executing programs at the shell level. This article series will introduce you to these tools. It is excerpted from chapter 10 of the book Beginning PHP and PostgreSQL 8: From Novice to Professional, written by W. Jason Gilmore and Robert H. Treat (Apress; ISBN: 1590595475).
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/Working-with-the-File-and-Operating-System-with-PHP/
)
[14] => SimpleXMLElement Object
(
[title] => PHP Proxy Patterns: Completing a Blog
[pubDate] => Mon, 31 Oct 2011 00:14:45 -0400
[link] => http://www.devshed.com/c/a/PHP/PHP-Proxy-Patterns-Completing-a-Blog/
[description] => In this third part of a series on proxy objects, we'll create a simple service layer to add to our blog program. With this finished application, you'll see exactly how proxy objects can be powerful allies when you need to persist the entities of a domain model in a database.
[category] => PHP
[guid] => http://www.devshed.com/c/a/PHP/PHP-Proxy-Patterns-Completing-a-Blog/
)
)
)
)
Donate
If you found this article useful and would like to see more like it this please consider making a donation.
