How to apply a filter in XML to import the records using PHP?

Asked

Viewed 36 times

0

I have an XML with several records to make an import with PHP. The importing part is ok, but I wanted to make a filter before importing, for example, import only the record that has ID 444, how can I do this?

I thought to download the xml edit and save as a new XML, would that?

XML example:

<Imoveis>
 <Imovel>
  <Id>123</Id>
 </Imovel>
 <Imovel>
  <Id>444</Id>
 </Imovel>
</Imoveis>

I’m using the $xml = new SimpleXMLElement($return) to download xml, where $return is the XML value returned from an API.

  • Isn’t it just a comparison already seen that you need to create a loop on the nodes? As you are doing, it’s nice to put the current code.

  • So that’s the comparison I don’t know how to make. The script that makes the import is one that I already use ready, I will see if I can here take only the part that makes the import

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.