Files
cdnPRO/kalsport-pl/xml-convert.php
2024-10-25 16:01:25 +02:00

95 lines
2.7 KiB
PHP

<?
$file = file_get_contents( 'https://kalsport.pl/modules/xmlfeeds/xml_files/feed_8.xml' );
$xml = new SimpleXMLElement( $file );
foreach ($xml->xpath('//item/*[
not(
name() = "g:id"
or name() = "g:title"
)
]') as $child) unset($child[0]);
$label_name = 'g:custom_label_0';
for ( $i = 0; $i < count( $xml -> channel -> item ); $i++ )
{
$xml -> channel -> item[$i] -> $label_name = 'pilki-do-kosza';
}
$xml -> asXml( 'pilki-do-kosza.xml' );
echo '<p>wygenerowano https://cdn.projectpro.pl/kalsport-pl/pilki-do-kosza.xml</p>';
$file = file_get_contents( 'https://kalsport.pl/modules/xmlfeeds/xml_files/feed_9.xml' );
$xml = new SimpleXMLElement( $file );
foreach ($xml->xpath('//item/*[
not(
name() = "g:id"
or name() = "g:title"
)
]') as $child) unset($child[0]);
$label_name = 'g:custom_label_0';
for ( $i = 0; $i < count( $xml -> channel -> item ); $i++ )
{
$xml -> channel -> item[$i] -> $label_name = 'pilki-lekarskie';
}
$xml -> asXml( 'pilki-lekarskie.xml' );
echo '<p>wygenerowano https://cdn.projectpro.pl/kalsport-pl/pilki-lekarskie.xml</p>';
$file = file_get_contents( 'https://kalsport.pl/modules/xmlfeeds/xml_files/feed_10.xml' );
$xml = new SimpleXMLElement( $file );
foreach ($xml->xpath('//item/*[
not(
name() = "g:id"
or name() = "g:title"
)
]') as $child) unset($child[0]);
$label_name = 'g:custom_label_0';
for ( $i = 0; $i < count( $xml -> channel -> item ); $i++ )
{
$xml -> channel -> item[$i] -> $label_name = 'pilki-nozne';
}
$xml -> asXml( 'pilki-nozne.xml' );
echo '<p>wygenerowano https://cdn.projectpro.pl/kalsport-pl/pilki-nozne.xml</p>';
$file = file_get_contents( 'https://kalsport.pl/modules/xmlfeeds/xml_files/feed_11.xml' );
$xml = new SimpleXMLElement( $file );
foreach ($xml->xpath('//item/*[
not(
name() = "g:id"
or name() = "g:title"
)
]') as $child) unset($child[0]);
$label_name = 'g:custom_label_0';
for ( $i = 0; $i < count( $xml -> channel -> item ); $i++ )
{
$xml -> channel -> item[$i] -> $label_name = 'pilki-reczne';
}
$xml -> asXml( 'pilki-reczne.xml' );
echo '<p>wygenerowano https://cdn.projectpro.pl/kalsport-pl/pilki-reczne.xml</p>';
$file = file_get_contents( 'https://kalsport.pl/modules/xmlfeeds/xml_files/feed_12.xml' );
$xml = new SimpleXMLElement( $file );
foreach ($xml->xpath('//item/*[
not(
name() = "g:id"
or name() = "g:title"
)
]') as $child) unset($child[0]);
$label_name = 'g:custom_label_0';
for ( $i = 0; $i < count( $xml -> channel -> item ); $i++ )
{
$xml -> channel -> item[$i] -> $label_name = 'pilki-siatkowe';
}
$xml -> asXml( 'pilki-siatkowe.xml' );
echo '<p>wygenerowano https://cdn.projectpro.pl/kalsport-pl/pilki-siatkowe.xml</p>';