title: How to get attribute of node with namespace using SimpleXML PHP?
body: <p>i'm trying to get the attribute info. of some fields.
  This is the xml.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;cfdi:Receptor nombre="JOSE GARCIA" rfc="GAJO540225EZ3"&gt;&lt;cfdi:Domicilio calle="Conocido San Cristobal Casa 1" codigoPostal="47503" colonia="Rancho San Cristobal" estado="Jalisco" municipio="Lagos de Moreno" noExterior="S/N" noInterior="N/A" pais="Mexico" /&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm trying get the values with this code (part of them), using the rules of the namespaces with simplexml, can anyone tell me how this works?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$xml = simplexml_load_file("factura.xml") or die("ERROR: Cannot create SimpleXML object");
  //print_r($xml);
  // open MySQL connection
  $connection = mysqli_connect("localhost", "root", "", "rbp") or die ("ERROR: Cannot connect");
  // process node data
  // create and execute INSERT queries
  foreach ($xml-&gt;cfdi-&gt;ExpedidoEn as $Receptor) {
  $atributos = $Receptor-&gt;attributes();
  $rfc = $atributos-&gt;rfc; //y no $product-&gt;name
  $nombre_rs = $atributos-&gt;nombre;
  $calle = $atributos-&gt;calle;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I see this error on php: Warning: Invalid argument supplied for foreach() </p>