Advertisement
nicolaslagios

bestprice single products

May 22nd, 2023
826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_errors', 1);
  4. ini_set('display_startup_errors', 1);
  5. error_reporting(E_ALL);
  6.  
  7.     //header('Content-type: text/xml');
  8.    
  9.     //Διάβασμα single προιόντων από xml
  10.     //readfile("https://bodypro.gr/wp-load.php?security_token=f24e75561a0614fd&export_id=4&action=get_data");
  11.     $url = 'https://bodypro.gr/wp-load.php?security_token=f24e75561a0614fd&export_id=4&action=get_data';
  12. $file_path = '/home/bodypro/public_html/API/bestprice/bestprice.xml';
  13.  
  14. // Download the contents of the file
  15. $xml_content = file_get_contents($url);
  16.  
  17. // Check if the XML content is valid
  18. if (simplexml_load_string($xml_content)) {
  19.     // Overwrite the existing file with the new content
  20.     file_put_contents($file_path, $xml_content);
  21.     echo "done!!!";
  22. } else {
  23.     // The XML content is not valid, do not overwrite the existing file
  24.     echo "Invalid XML content";
  25. }
  26.  
  27. // Redirect to the saved file
  28. //header('Location: ' . $file_path);
  29. //exit;
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement