Saturday, 10 September 2016

How to parse XML Youtube Feeds in PHP into array format?

        $ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
$xml = simplexml_load_string($output);
$youtubedata = json_decode(json_encode((array)$xml), TRUE);

No comments:

Post a Comment

Your comment is so valuable as it would help me in my growth of knowledge.