tags:

views:

19

answers:

0

Hello there!

I want to get several xml-feeds using curl.

    $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $feed);
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);
function parseRSS($xml) {
    $cnt = count($xml->channel->item);
    for($i=0; $i<$cnt; $i++) {
        $rss_link   = $xml->channel->item[$i]->link;
        $rss_title  = $xml->channel->item[$i]->title;
        $rss_title = utf8_decode($rss_title);
        $rss_text = $xml->channel->item[$i]->description;
        $rss_text = utf8_decode($rss_text);
        $rss_text = strip_tags($rss_text, "");
        $rss_text = substr($rss_text, 0, 200);

...and then echo out the text... and call the function parseRSS... and display the content on the webpage using jquery ajax.

So I want somehow to be able to get many url at the same time. The feed is taken from mysql. Shall I use WHILE or ARRAY? I have a feeling there is a very simple answer to this. I have tried different CURL_MULTI from php.net. However, I can't make anything to fit here.

Thank You so much in advance!