Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6084875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:34:29+00:00 2026-05-23T11:34:29+00:00

im using DOMDocuments to download an RSS feed into my PHP script, simple by:

  • 0

im using DOMDocuments to download an RSS feed into my PHP script, simple by:

$doc = new DOMDocument();
$doc->load($source);

I want to use instead of DOMDocument, CURL. How can change those 2 lines of code to make all my script compatible?. This is my complete script by the way:

<?php
//PUBLIC VARS
$arrFeeds = array();
$downItems = 0;
$time_taken = 0;
//*PUBLIC VARS
function getRSS($source) {
    $start = microtime(true);
    ini_set('default_socket_timeout', 1);
    global $arrFeeds, $downItems, $time_taken;
    $arrFeeds = array();
    $doc = new DOMDocument();
    $doc->load($source);
    foreach ($doc->getElementsByTagName('item') as $node) {
        $itemRSS = array ( 
            'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
            'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
            'link' => $node->getElementsByTagName('link')->item(0)->nodeValue
        );
        array_push($arrFeeds, $itemRSS);
        $downItems+=1;
    }
    $time_taken = microtime(true) - $start;
}
//getRSS("http://www.atm-mi.it/_layouts/atm/apps/PublishingRSS.aspx?web=388a6572-890f-4e0f-a3c7-a3dd463f7252&c=News%20Infomobilita");
//echo(strip_tags($arrFeeds[0]['title'])."<br><br>".$time_taken);
?>

Thanks for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:34:29+00:00Added an answer on May 23, 2026 at 11:34 am

    This ought to do it:

    $ch = curl_init($source);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $content = curl_exec($ch);
    curl_close($ch);
    $doc = new DOMDocument();
    $doc->loadXML($content);
    

    Your mileage may vary, of course, and you might have to add more CURL options, but that’s basic enough functionality to get it all started.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With this code using DomDocument: <?php $html = '<pre>one</pre><pre>two</pre><pre>three</pre><pre>four</pre>'; $doc = new DomDocument(); $doc->loadHTML($html);
i'm using the DOMdocument class in php whenever i want to create a XML
i'm trying to insert data into xml using php domdocument. however when i hit
i'm inserting the data into an xml file using php domdocument. however when i
I am using the loadhtml function ( http://php.net/manual/en/domdocument.loadhtml.phpt ) to load up an external
I'm reading some XML with PHP and currently using the DOMDocument class to do
For one of my projects, I'm using the DOMDocument class to load and manipulate
I'm using PHP's DOMDocument to parse and normalize user-submitted HTML using the loadHTML method
In PHP I'm using DOMDocument and I need to search for an element that
When I try to write UTF-8 Strings into an XML file using DOMDocument it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.