Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- //header('Content-type: text/xml');
- //Διάβασμα single προιόντων από xml
- //readfile("https://bodypro.gr/wp-load.php?security_token=f24e75561a0614fd&export_id=4&action=get_data");
- $url = 'https://bodypro.gr/wp-load.php?security_token=f24e75561a0614fd&export_id=4&action=get_data';
- $file_path = '/home/bodypro/public_html/API/bestprice/bestprice.xml';
- // Download the contents of the file
- $xml_content = file_get_contents($url);
- // Check if the XML content is valid
- if (simplexml_load_string($xml_content)) {
- // Overwrite the existing file with the new content
- file_put_contents($file_path, $xml_content);
- echo "done!!!";
- } else {
- // The XML content is not valid, do not overwrite the existing file
- echo "Invalid XML content";
- }
- // Redirect to the saved file
- //header('Location: ' . $file_path);
- //exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement