fork download
  1. <?php
  2. // URL du fichier XML distant
  3. $xmlFile = 'https://w...content-available-to-author-only...e.vn/api/v3/files/folder?linkcode=SGMJL12ZIALVCTS';
  4.  
  5. // Charger le fichier XML depuis l'URL
  6. $xmlContent = file_get_contents($xmlFile);
  7.  
  8. if ($xmlContent === false) {
  9. die('Erreur : Impossible de récupérer le fichier XML depuis l\'URL');
  10. }
  11.  
  12. $xml = simplexml_load_string($xmlContent);
  13.  
  14. if ($xml === false) {
  15. die('Erreur : Impossible de parser le contenu XML');
  16. }
  17.  
  18. // Créer un tableau pour stocker les résultats
  19. $results = [];
  20.  
  21. // Parcourir tous les éléments <item>
  22. foreach ($xml->items->item as $item) {
  23. $results[] = [
  24. 'linkcode' => (string)$item->linkcode,
  25. 'name' => (string)$item->name
  26. ];
  27. }
  28.  
  29. // Afficher les résultats
  30. echo "<table border='1' style='border-collapse: collapse; width: 100%;'>";
  31. echo "<tr style='background-color: #f2f2f2;'><th style='padding: 8px;'>Linkcode</th><th style='padding: 8px;'>Nom du fichier</th></tr>";
  32.  
  33. foreach ($results as $item) {
  34. echo "<tr>";
  35. echo "<td style='padding: 8px; border: 1px solid #ddd;'>" . htmlspecialchars($item['linkcode']) . "</td>";
  36. echo "<td style='padding: 8px; border: 1px solid #ddd;'>" . htmlspecialchars($item['name']) . "</td>";
  37. echo "</tr>";
  38. }
  39.  
  40. echo "</table>";
  41.  
  42. // Optionnel : afficher le nombre total d'éléments
  43. echo "<p style='margin-top: 20px;'>Total: " . count($results) . " fichiers trouvés</p>";
  44. ?>
Success #stdin #stdout #stderr 0.02s 26364KB
stdin
Standard input is empty
stdout
Erreur : Impossible de récupérer le fichier XML depuis l'URL
stderr
PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/NON8SI/prog.php on line 6
PHP Warning:  file_get_contents(https://w...content-available-to-author-only...e.vn/api/v3/files/folder?linkcode=SGMJL12ZIALVCTS): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/NON8SI/prog.php on line 6