Add XML feed processing scripts for laitica.pl and wyprzedaze.pl
- Implemented XML fetching and processing for laitica.pl, replacing domain links and saving the modified XML to laitica_feed.xml. - Created a similar script for wyprzedaze.pl, with domain link replacements and saving to wyprzedaze_feed.xml. - Both scripts handle errors for XML fetching and parsing, ensuring robust operation.
This commit is contained in:
BIN
ibramakeup/Graphie/Graphie-Bold.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-Bold.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-BoldItalic.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-BoldItalic.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-Book.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-Book.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-BookItalic.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-BookItalic.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-ExtraBold.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-ExtraBold.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-ExtraBoldItalic.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-ExtraBoldItalic.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-ExtraLight.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-ExtraLight.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-ExtraLightItalic.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-ExtraLightItalic.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-Italic.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-Italic.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-Light.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-Light.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-LightItalic.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-LightItalic.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-Regular.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-Regular.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-SemiBold.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-SemiBold.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-SemiBoldItalic.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-SemiBoldItalic.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-Thin.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-Thin.otf
Normal file
Binary file not shown.
BIN
ibramakeup/Graphie/Graphie-ThinItalic.otf
Normal file
BIN
ibramakeup/Graphie/Graphie-ThinItalic.otf
Normal file
Binary file not shown.
2
ibramakeup/feed-main-RU.xml
Normal file
2
ibramakeup/feed-main-RU.xml
Normal file
File diff suppressed because one or more lines are too long
2
ibramakeup/feed-main.xml
Normal file
2
ibramakeup/feed-main.xml
Normal file
File diff suppressed because one or more lines are too long
2
ibramakeup/feed-zaufane.xml
Normal file
2
ibramakeup/feed-zaufane.xml
Normal file
File diff suppressed because one or more lines are too long
59
ibramakeup/index.php
Normal file
59
ibramakeup/index.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// Adres źródłowego pliku XML
|
||||
$sourceUrl = 'https://xml-feed.app.softitdigital.com/ibra-makeup.myshopify.com/feeds/view/cmi5215vf1f4czycu5150rxkp.xml';
|
||||
|
||||
// Dokąd zapisujemy plik na serwerze (relatywnie do tego skryptu)
|
||||
$outputFile = __DIR__ . '/ibra-makeup_feed.xml';
|
||||
|
||||
// Domena do podmiany
|
||||
$oldDomain = 'https://ibra-makeup.myshopify.com';
|
||||
$newDomain = 'https://ibra-makeup.pl';
|
||||
|
||||
// --- 1. Pobranie XML ---
|
||||
$xmlString = @file_get_contents($sourceUrl);
|
||||
|
||||
if ($xmlString === false) {
|
||||
die('Nie udało się pobrać pliku XML ze źródła.');
|
||||
}
|
||||
|
||||
// --- 2. Wczytanie XML z przestrzeniami nazw ---
|
||||
$xml = @simplexml_load_string($xmlString);
|
||||
|
||||
if ($xml === false) {
|
||||
die('Nie udało się zinterpretować pliku XML.');
|
||||
}
|
||||
|
||||
// Pobranie listy namespace’ów (m.in. "g")
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
// Upewniamy się, że mamy namespace "g"
|
||||
if (!isset($namespaces['g'])) {
|
||||
die('W pliku XML nie znaleziono przestrzeni nazw "g".');
|
||||
}
|
||||
|
||||
// --- 3. Podmiana domeny w każdym <g:link> ---
|
||||
foreach ($xml->channel->item as $item) {
|
||||
// Dzieci w przestrzeni nazw g
|
||||
$gChildren = $item->children($namespaces['g']);
|
||||
|
||||
if (isset($gChildren->link)) {
|
||||
$currentLink = (string) $gChildren->link;
|
||||
// Podmiana samej domeny na nową
|
||||
$newLink = str_replace($oldDomain, $newDomain, $currentLink);
|
||||
$gChildren->link = $newLink;
|
||||
}
|
||||
}
|
||||
|
||||
// --- 4. Zapis zmodyfikowanego XML na serwerze ---
|
||||
if ($xml->asXML($outputFile) === false) {
|
||||
die('Nie udało się zapisać zmodyfikowanego pliku XML na serwerze.');
|
||||
}
|
||||
|
||||
// --- 5. Zbudowanie URL do zapisanego pliku i wyświetlenie go ---
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
|
||||
|
||||
$fileUrl = $scheme . '://' . $host . $path . '/ibra-makeup_feed.xml';
|
||||
|
||||
echo 'Nowy plik XML został zapisany tutaj: <a href="' . htmlspecialchars($fileUrl, ENT_QUOTES, 'UTF-8') . '">' . htmlspecialchars($fileUrl, ENT_QUOTES, 'UTF-8') . '</a>';
|
||||
2
ibramakeup/styles/style.css
Normal file
2
ibramakeup/styles/style.css
Normal file
File diff suppressed because one or more lines are too long
9
ibramakeup/styles/style.css.map
Normal file
9
ibramakeup/styles/style.css.map
Normal file
File diff suppressed because one or more lines are too long
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
$file = file_get_contents('https://sklep744813.shoparena.pl/console/integration/execute/name/GoogleProductSearch/lang/pl_PL');
|
||||
$xml = new SimpleXMLElement($file);
|
||||
|
||||
for ($i = 0; $i < count($xml->entry); $i++) {
|
||||
// Odnalezienie elementu shipping dla aktualnego item
|
||||
$shipping = $xml->entry[$i]->shipping;
|
||||
if ($shipping) {
|
||||
// Dodanie nowego elementu g:max_transit_time do shipping
|
||||
$shipping->addChild('g:max_transit_time', '2'); // Możesz zastąpić 'TwojaWartość' odpowiednią wartością
|
||||
$shipping->addChild('g:max_handling_time', '1'); // Możesz zastąpić 'TwojaWartość' odpowiednią wartością
|
||||
}
|
||||
}
|
||||
|
||||
$xml->asXml('feed-main.xml');
|
||||
echo '<p>wygenerowano https://cdn.projectpro.pl/ibramakeup/feed-main.xml</p>';
|
||||
|
||||
// Wczytaj plik XML
|
||||
$xmlString = file_get_contents('https://sklep744813.shoparena.pl/console/integration/execute/name/GoogleProductSearch/lang/pl_PL');
|
||||
$xml = new SimpleXMLElement( $xmlString );
|
||||
|
||||
// Nazwy elementów do usunięcia
|
||||
$elementsToRemove = [
|
||||
'description',
|
||||
'g:condition',
|
||||
'g:availability',
|
||||
'g:price',
|
||||
'g:sale_price',
|
||||
'g:sale_price_effective_date',
|
||||
'g:shipping_weight',
|
||||
'g:shipping',
|
||||
];
|
||||
|
||||
// Namespace dla elementów 'g'
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
$gNamespace = $namespaces['g'];
|
||||
|
||||
// Pobierz wszystkie elementy entry
|
||||
foreach ($xml->entry as $entry)
|
||||
{
|
||||
foreach ($elementsToRemove as $elementName)
|
||||
{
|
||||
$elementParts = explode(':', $elementName);
|
||||
if (count($elementParts) == 2)
|
||||
{
|
||||
$prefix = $elementParts[0];
|
||||
$localName = $elementParts[1];
|
||||
$elements = $entry->children($namespaces[$prefix])->$localName;
|
||||
foreach ($elements as $element)
|
||||
{
|
||||
// Usuń element z przestrzenią nazw
|
||||
$domElement = dom_import_simplexml($element);
|
||||
$domElement->parentNode->removeChild($domElement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Usuń element bez przestrzeni nazw
|
||||
$elements = $entry->$elementName;
|
||||
foreach ($elements as $element)
|
||||
{
|
||||
$domElement = dom_import_simplexml($element);
|
||||
$domElement->parentNode->removeChild($domElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Zapisz zmodyfikowany XML do nowego pliku
|
||||
$xml->asXML( 'feed-zaufane.xml' );
|
||||
echo '<p>wygenerowano https://cdn.projectpro.pl/ibramakeup/feed-zaufane.xml</p>';
|
||||
59
laitica.pl/index.php
Normal file
59
laitica.pl/index.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// Adres źródłowego pliku XML
|
||||
$sourceUrl = 'https://xml-feed.app.softitdigital.com/655bc1.myshopify.com/feeds/view/cmi50kyg80827zycu278tbo2b.xml';
|
||||
|
||||
// Dokąd zapisujemy plik na serwerze (relatywnie do tego skryptu)
|
||||
$outputFile = __DIR__ . '/laitica_feed.xml';
|
||||
|
||||
// Domena do podmiany
|
||||
$oldDomain = 'https://655bc1.myshopify.com';
|
||||
$newDomain = 'https://laitica.pl';
|
||||
|
||||
// --- 1. Pobranie XML ---
|
||||
$xmlString = @file_get_contents($sourceUrl);
|
||||
|
||||
if ($xmlString === false) {
|
||||
die('Nie udało się pobrać pliku XML ze źródła.');
|
||||
}
|
||||
|
||||
// --- 2. Wczytanie XML z przestrzeniami nazw ---
|
||||
$xml = @simplexml_load_string($xmlString);
|
||||
|
||||
if ($xml === false) {
|
||||
die('Nie udało się zinterpretować pliku XML.');
|
||||
}
|
||||
|
||||
// Pobranie listy namespace’ów (m.in. "g")
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
// Upewniamy się, że mamy namespace "g"
|
||||
if (!isset($namespaces['g'])) {
|
||||
die('W pliku XML nie znaleziono przestrzeni nazw "g".');
|
||||
}
|
||||
|
||||
// --- 3. Podmiana domeny w każdym <g:link> ---
|
||||
foreach ($xml->channel->item as $item) {
|
||||
// Dzieci w przestrzeni nazw g
|
||||
$gChildren = $item->children($namespaces['g']);
|
||||
|
||||
if (isset($gChildren->link)) {
|
||||
$currentLink = (string) $gChildren->link;
|
||||
// Podmiana samej domeny na nową
|
||||
$newLink = str_replace($oldDomain, $newDomain, $currentLink);
|
||||
$gChildren->link = $newLink;
|
||||
}
|
||||
}
|
||||
|
||||
// --- 4. Zapis zmodyfikowanego XML na serwerze ---
|
||||
if ($xml->asXML($outputFile) === false) {
|
||||
die('Nie udało się zapisać zmodyfikowanego pliku XML na serwerze.');
|
||||
}
|
||||
|
||||
// --- 5. Zbudowanie URL do zapisanego pliku i wyświetlenie go ---
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
|
||||
|
||||
$fileUrl = $scheme . '://' . $host . $path . '/laitica_feed.xml';
|
||||
|
||||
echo 'Nowy plik XML został zapisany tutaj: <a href="' . htmlspecialchars($fileUrl, ENT_QUOTES, 'UTF-8') . '">' . htmlspecialchars($fileUrl, ENT_QUOTES, 'UTF-8') . '</a>';
|
||||
59
wyprzedaze.pl/index.php
Normal file
59
wyprzedaze.pl/index.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// Adres źródłowego pliku XML
|
||||
$sourceUrl = 'https://xml-feed.app.softitdigital.com/wyprzedaze.myshopify.com/feeds/view/cmi52jjvt1ibbzycu3oy19bxe.xml';
|
||||
|
||||
// Dokąd zapisujemy plik na serwerze (relatywnie do tego skryptu)
|
||||
$outputFile = __DIR__ . '/wyprzedaze_feed.xml';
|
||||
|
||||
// Domena do podmiany
|
||||
$oldDomain = 'https://wyprzedaze.myshopify.com';
|
||||
$newDomain = 'https://wyprzedaze.pl';
|
||||
|
||||
// --- 1. Pobranie XML ---
|
||||
$xmlString = @file_get_contents($sourceUrl);
|
||||
|
||||
if ($xmlString === false) {
|
||||
die('Nie udało się pobrać pliku XML ze źródła.');
|
||||
}
|
||||
|
||||
// --- 2. Wczytanie XML z przestrzeniami nazw ---
|
||||
$xml = @simplexml_load_string($xmlString);
|
||||
|
||||
if ($xml === false) {
|
||||
die('Nie udało się zinterpretować pliku XML.');
|
||||
}
|
||||
|
||||
// Pobranie listy namespace’ów (m.in. "g")
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
// Upewniamy się, że mamy namespace "g"
|
||||
if (!isset($namespaces['g'])) {
|
||||
die('W pliku XML nie znaleziono przestrzeni nazw "g".');
|
||||
}
|
||||
|
||||
// --- 3. Podmiana domeny w każdym <g:link> ---
|
||||
foreach ($xml->channel->item as $item) {
|
||||
// Dzieci w przestrzeni nazw g
|
||||
$gChildren = $item->children($namespaces['g']);
|
||||
|
||||
if (isset($gChildren->link)) {
|
||||
$currentLink = (string) $gChildren->link;
|
||||
// Podmiana samej domeny na nową
|
||||
$newLink = str_replace($oldDomain, $newDomain, $currentLink);
|
||||
$gChildren->link = $newLink;
|
||||
}
|
||||
}
|
||||
|
||||
// --- 4. Zapis zmodyfikowanego XML na serwerze ---
|
||||
if ($xml->asXML($outputFile) === false) {
|
||||
die('Nie udało się zapisać zmodyfikowanego pliku XML na serwerze.');
|
||||
}
|
||||
|
||||
// --- 5. Zbudowanie URL do zapisanego pliku i wyświetlenie go ---
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
|
||||
|
||||
$fileUrl = $scheme . '://' . $host . $path . '/wyprzedaze_feed.xml';
|
||||
|
||||
echo 'Nowy plik XML został zapisany tutaj: <a href="' . htmlspecialchars($fileUrl, ENT_QUOTES, 'UTF-8') . '">' . htmlspecialchars($fileUrl, ENT_QUOTES, 'UTF-8') . '</a>';
|
||||
Reference in New Issue
Block a user