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

  • Home
  • SEARCH
  • 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 6060117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:47:20+00:00 2026-05-23T08:47:20+00:00

I have a small problem with a script that reads an XML file and

  • 0

I have a small problem with a script that reads an XML file and prints the output:

<?php

  $doc = new DOMDocument();
  $doc->load("http://www.tripadvisor.it/Feeds-d235955-treviews.xml");
  foreach ($doc->getElementsByTagName('item') as $node) {
      echo $node->getElementsByTagName('title')->item(0)->nodeValue;
      echo $node->getElementsByTagName('description')->item(0)->nodeValue;
      echo $node->getElementsByTagName('link')->item(0)->nodeValue;
      echo $node->getElementsByTagName('pubDate')->item(0)->nodeValue;
  }

?> 

If you use this script on my personal domain (hosting) it works fine, but if I use on my VPS does not work and returns these errors:

Warning: DOMDocument::load(http://www.tripadvisor.it/Feeds-d235955-treviews.xml) [domdocument.load]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/AAA/public_html/test.php on line 4
Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "http://www.tripadvisor.it/Feeds-d235955-treviews.xml" in /home/AAA/public_html/test.php on line 4

Which PHP or APACHE settings that may cause problems?

  • 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-23T08:47:20+00:00Added an answer on May 23, 2026 at 8:47 am

    As file_get_contents is not working in your server so try to use use curl to connect with tripadvisor server as below

    <?php
    $init = curl_init();
    curl_setopt($init, CURLOPT_URL,'http://www.tripadvisor.it/Feeds-d235955-treviews.xml');
    curl_setopt($init, CURLOPT_RETURNTRANSFER, 1);
    $contents = curl_exec ($init);
    curl_close ($init);
    $xml = simplexml_load_string($contents);
    print"<pre>";
    print_r($xml);
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this small script that sorts the content of a text file #
I have a small problem with a script. I want to have a default
I have a small problem with my jQuery script. <script language=javascript> $(document).ready(function(){ $('.roll-li').click(function(){ if
I currently have a small Python script that I'm using to spawn multiple executables,
I'm new to JQuery and have a script that creates a dialog via Ajax
I have a small issue on a search form. PLease check this: http://www.fortisfitness.ca/test/script.php What's
I have small problem with my .net 2.0 winforms application. I want to embed
I have a small problem with interfaces. Here it is in Pseudo code :
I have a small problem with how should i think a... problem. I want
SQL to find duplicate entries (within a group) I have a small problem and

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.