59 lines
No EOL
1.9 KiB
PHP
59 lines
No EOL
1.9 KiB
PHP
<?php
|
|
|
|
error_reporting(-1);
|
|
ini_set('display_errors', 'On');
|
|
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
//$url='https://api.ilonexs.de/php/schnittstellen_url.php?api=MbL~9X2kZU~&schnittstelle=1&';
|
|
//$url='https://api.ilonexs.de/php/schnittstellen_url.php?api=MbL~9X2kZU~&schnittstelle=1/schnittstellen_url.php';
|
|
$url = 'https://mob.ilonexs.de/php/prj_web/mob_meineimporte.php?ak=MbL~9X2kZU~';
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
$domDocument = new DOMDocument();
|
|
|
|
@$domDocument->loadHTMLFile($url);
|
|
|
|
$xpath = new DOMXPath($domDocument);
|
|
|
|
//$elements = $xpath->query('//div[@class="elementor-shortcode"]/script');
|
|
$elements = $xpath->query('//table[@id="Summe"]');
|
|
echo "<pre>"; print_r($elements); echo "</pre>";
|
|
|
|
|
|
|
|
if($elements->length === 0){
|
|
echo "Keine Elemente zum Selector gefunden";
|
|
return;
|
|
}
|
|
|
|
$context = stream_context_create([
|
|
'http'=>[
|
|
'header'=>['Accept: application/json']
|
|
]
|
|
]);
|
|
|
|
foreach($elements as $element){
|
|
|
|
|
|
$source = $element->getAttribute('td');
|
|
if(!$source){
|
|
echo "Attribut data-configuration wurde nicht gefunden";
|
|
continue;
|
|
}
|
|
$json = file_get_contents($source,false,$context);
|
|
$data = json_decode($json);
|
|
|
|
$fileName = str_replace(['?', '"', '/', '*', '|', ':', '<', '>'], '-', $data->episode->title).'.mp3';
|
|
$mp3Source = $data->episode->media->mp3;
|
|
|
|
file_put_contents($fileName, fopen($mp3Source,'r'));
|
|
echo sprintf("Neueste Podcast Episode mit dem Titel '%s' wurde heruntergeladen", $fileName);
|
|
break;
|
|
}
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
|
|
echo "<pre>"; print_r($element); echo "</pre>";
|
|
echo "<pre>"; print_r($output); echo "</pre>";
|
|
|
|
?>
|