Hello I have the following php code, from the output $doc I want to take all the [content] items and put them together for use in a tag cloud. How can I extract all the [content] items into one variable?
$ch = curl_init("http://api.sysomos.com/hb/v1/heartbeat/rss?startid=0&hbrss=DUpnCTqppKjx4q1U6FXd5SWOPFUa2ltLm1haXJAYi1hbmQtcS5jby51aw..&maxC=6&max=30&hid=2535& fTs=me&dRg=7&tab=beats&scO=Recency&");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);
$doc = new SimpleXmlElement($data, LIBXML_NOCDATA);
print_r($doc);
Without further clarification, it seems you’re having trouble getting the string value of the individual
<content>nodes? If so, consider the following:This will output:
UPDATE
As per your comment, you could use the same tactic above with an additional
implodecall like so:Or, modify the original loop to do: