Error loading XML failed to load external entity

1

Good morning, I am working with google news rss and access the rss as xml with php7 and iis7, I am using simplexml_load_file but it does not work and it sets me as output.

  

Error loading XML failed to load external entity

this is my code

libxml_use_internal_errors(true);
$sxe = simplexml_load_file($feed_url);
if ($sxe === false) {
    echo "Error cargando XML\n";
    foreach(libxml_get_errors() as $error) {
        echo "\t", $error->message;
    }
}

I was working with php 5 and if I worked with this code

$xml = simplexml_load_file($feed_url);
foreach ($xml as $value) {            
        foreach ($value->item as $lue) {
          $title = $lue->title;
          $link = $lue->link;
          $description = $lue->description;
          $author = "Google";
          $pubdate = $lue->pubDate;
          $variablePHP1 = $nombre.'+'.$title.'+'.$pubdate;

          $query_insert = "INSERT INTO Publicaciones (Alias_Publicaciones,Clave,Nombre,title, link, description, author , pubdate, grupo1, grupo2, grupo3,url) values ('$variablePHP1','$clave','$nombre','$title','$link','$description','$author','$pubdate', '$gpo1', '$gpo2', '$gpo3', '$url')";
          $cons_insert= sqlsrv_query($connMI,$query_insert)or die (print_r(sqlsrv_errors(), true));
        }                              
      }

with php 7 I did the same but it does not do anything to me $ feed_url is my url of the rss

I hope you can help me thanks

    
asked by j ch 03.05.2018 в 16:07
source

0 answers