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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:31:44+00:00 2026-05-31T04:31:44+00:00

I’m trying to parse the contents of an remote XML file into MySQL, so

  • 0

I’m trying to parse the contents of an remote XML file into MySQL, so I can put these contents in my database.

I’m not fimiliar with XML at all, so sorry if I’ll be asking stupid questions.

I have a site: http://www.hodexer.nl/hodex/uva/hodexDirectory.xml. For every hodexRecourse, I want to get the programID, and visit the URL stored in hodexResourceURL, and from that XML file, I want every programName and programSummary and store these into the database as well.

I know the global set up I should use, but I’m not getting very far. So far I have this:

$xmlstr = simpleXML_load_file('http://www.hodexer.nl/hodex/uva/hodexDirectory.xml');
  if ($xmlstr === FALSE) {
    show_404();
  }
  else {
    $xml = new SimpleXMLElement($xmlstr, NULL, TRUE);
    foreach ($xml->hodexResource as $temp) {
      echo $temp->programID;
  }

The echo is just for debugging purpouses. I get the following error: String could not be parsed as XML.

I hope you can help me out!

  • 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-31T04:31:45+00:00Added an answer on May 31, 2026 at 4:31 am

    the function simpleXML_load_file returns an SimpleXmlObject, is not necessary to call the constructor, you can see this in http://www.php.net/manual/es/class.simplexmlelement.php

    Try this code:

    <?php
    $xmlstr = simpleXML_load_file('http://www.hodexer.nl/hodex/uva/hodexDirectory.xml');
      //print_r ( $xmlstr ); //uncomment for debugging
      if ($xmlstr === FALSE) {
        show_404();
      }
      else {
        foreach ($xmlstr->hodexResource as $temp) {
          echo $temp->programId;
      }
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a reasonable size flat file database of text documents mostly saved in
I'm parsing an XML file, the creators of it stuck in a bunch social
I am trying to loop through a bunch of documents I have to put
i want to parse a xhtml file and display in UITableView. what is the

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.