aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Ortlepp <post@ortlepp.eu>2021-09-29 00:45:52 +0200
committerThorsten Ortlepp <post@ortlepp.eu>2021-09-29 00:45:52 +0200
commit56a86a1877c2d7dbc293c825a3cd606baad8e24b (patch)
tree46a2b122501f8c49e54cb39a38526330c6bf5d32
parent5e3180be6b9aab92c84960e86a031c3b4107bb56 (diff)
downloadphp-stuff-56a86a1877c2d7dbc293c825a3cd606baad8e24b.zip
Support for subdirectory
-rw-r--r--feed2podcast/feed2podcast.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/feed2podcast/feed2podcast.php b/feed2podcast/feed2podcast.php
index 4c5f805..468aee8 100644
--- a/feed2podcast/feed2podcast.php
+++ b/feed2podcast/feed2podcast.php
@@ -38,14 +38,14 @@ echo '<pubDate>'.$xml->channel->pubDate.'</pubDate>';
echo '<lastBuildDate>'.$xml->channel->lastBuildDate.'</lastBuildDate>';
echo '<ttl>'.$xml->channel->ttl.'</ttl>';
echo '<image>';
-echo ' <url>https://'.$_SERVER['HTTP_HOST'].'/image.png</url>';
+echo ' <url>https://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/image.png</url>';
echo ' <title>'.$xml->channel->image->title.'</title>';
echo ' <link>'.$xml->channel->image->link.'</link>';
echo ' <description>'.$xml->channel->image->description.'</description>';
echo '</image>';
echo '<atom:link rel="self" type="application/rss+xml" href="https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'" />';
echo '<itunes:subtitle>Die Beiträge zur Sendung</itunes:subtitle>';
-echo '<itunes:image href="https://'.$_SERVER['HTTP_HOST'].'/image.png"/>';
+echo '<itunes:image href="https://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/image.png"/>';
echo '<itunes:new-feed-url>https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'</itunes:new-feed-url>';
echo '<itunes:owner>';
echo ' <itunes:name>Redaktion deutschlandradio.de</itunes:name>';
@@ -96,11 +96,11 @@ foreach ($xml->channel->item as $item) {
// Write episode to podcast feed
echo '<item>';
echo ' <title>'.$item->title.'</title>';
- echo ' <link>https://'.$_SERVER['HTTP_HOST'].'/'.$downloads.'/'.$filename.'</link>';
+ echo ' <link>https://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/'.$downloads.'/'.$filename.'</link>';
echo ' <description>'.str_replace("www.deutschlandfunk.de,", "", strip_tags($item->description)).'</description>';
echo ' <pubDate>'.$item->pubDate.'</pubDate>';
echo ' <guid>'.$item->guid.'</guid>';
- echo ' <enclosure url="https://'.$_SERVER['HTTP_HOST'].'/'.$downloads.'/'.$filename.'" length="'.filesize($downloads.'/'.$filename).'" type="'.$filetype.'"/>';
+ echo ' <enclosure url="https://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/'.$downloads.'/'.$filename.'" length="'.filesize($downloads.'/'.$filename).'" type="'.$filetype.'"/>';
echo ' <itunes:author>'.$content[0].'</itunes:author>';
echo ' <itunes:duration>'.$content[2].'</itunes:duration>';
echo '</item>';