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 3319514
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:50:01+00:00 2026-05-17T22:50:01+00:00

Why this code results empty in my hosting, but works well in my local?

  • 0

Why this code results empty in my hosting, but works well in my local?

$raw = file_get_contents($rssURL); 
$xml = new SimpleXmlElement($raw);

echo "<b>RSS Items:</b><br /><br />";
foreach($xml->channel->item as $item) {
    echo $item->title."</br >";
}

libxml version: 2.6.32; libxml2 version: 2.6.32

I also tried this code:

# INSTANTIATE CURL.
$curl = curl_init();

# CURL SETTINGS.
curl_setopt($curl, CURLOPT_URL, $rssURL);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curl, CURLOPT_VERBOSE, 1);  
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);  

# GRAB THE XML FILE.
$xml = curl_exec($curl);

curl_close($curl);

# SET UP XML OBJECT.
$xmlObj = simplexml_load_string($xml);

echo "<b>RSS Items:</b><br /><br />";
foreach($xmlObj->channel->item as $item) {
    echo $item->title."</br >";
}

echo "<br /><b>var_dump:</b><br><br>";
var_dump(libxml_get_errors())

The result was array(0) { }

Is there any differences between coding this snippet for Windows and Linux (I don’t think so)?

Any Idea’s?

  • 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-17T22:50:02+00:00Added an answer on May 17, 2026 at 10:50 pm

    Start with http://www.php.net/manual/en/function.libxml-get-errors.php and find out what errors simplexml_load_string() is throwing since it returns false on error.

    Also, your provider might not let you make outside calls from your software, just a thought.

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

Sidebar

Related Questions

This code:: xslProcessor = new XSLTProcessor(); xslProcessor.importStylesheet(xsl); result = xslProcessor.transformToFragment(xml, document); works fine in
This code works as expected (online here ). At the end v is empty
This is my code. Why it is showing empty results? Can you spot any
This code gives me an empty result. I expect it to print out the
I have this code that performs an ajax call and loads the results into
I've got this code snippet, and I'm wondering why the results of the first
here is my current line of code: $(<li>).text($(this).text()).appendTo(#theList); Which results in <ul id=theList> <li>blah</li>
I managed to get this code to compile with out error. But somehow it
I did a bit of searching but came up empty on this. I'm looking
I have a small section of code. When the table is empty this code

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.