Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Solved] PHP get, parsing rss into a html5 player

Featured Replies

[hide]Hi all,

 

Been a long time posting in this forum but I've come across something that I'm stumped at and could do with some advice. Let me explain some bits...

 

I have running on the server some software called DirCaster which reads the contents of folders to create an RSS feed. e.g. I have a folder on fromefm.co.uk/media/altfactor full of mp3 files. DirCaster created this on the fly when you put the folder in as a variable. See http://fromefm.co.uk...?show=altfactor

 

I am using an RSS parser called MagpieRSSwhich if I hardcode in the rss url works fine but doesn't work If I try to use _GET to change it.

 

<?php

require_once 'magpierss/rss_fetch.inc';
$url = 'http://fromefm.co.uk/archive/dircaster2.php?show=altfactor';
$rss = fetch_rss($url);
foreach ($rss->items as $item ) {
$title = $item[title];
$url = $item[guid];
$description = $item[description];
echo "<li><a href='#' data-src='$url'>$title</a></li>
";
}
?>

 

The above code successfully lists all the stuff in the podcast directory by running the magpie script which in turn runs dircaster to get the file listing. The problem arises when trying to make the $url variable dynamic.

 

I thought I could just do this to create my own new dynamic variable

$showname = $_GET['show'];

 

But when I put it into the main code it breaks.

 

<?php
$showname = $_GET['show'];
require_once 'magpierss/rss_fetch.inc';
$url = 'http://fromefm.co.uk/archive/dircaster2.php?show='+$showname;
$rss = fetch_rss($url);
foreach ($rss->items as $item ) {
$title = $item[title];
$url = $item[guid];
$description = $item[description];
echo "<li><a href='#' data-src='$url'>$title</a></li>
";
}
?>

 

I hope this makes sense. I've got an example page here which DOES have the variable to get a show name but still has the dircaster url hardcoded. There is an echo of $showname in the description to check it works. e.g http://www.frome.me/....php?show=tipit

 

Any ideas or advice would be helpful. Perhaps it's something MAgpie can't do. If so are there any other similar RSS->PHP parsers around that could do this?[/hide]

Solved. Thanks

 

 

Working (draft) script here: http://www.fromefm.c...er/?show=xxxxxx

 

examples:

http://www.fromefm.c...?show=altfactor

http://www.fromefm.c...=homelyremedies

http://www.fromefm.c.../?show=ourhouse

 

Thanks for the help guys.

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

  • Author

I should probably explain it's to basically parse the contents of the RSS into a playlist that audiojs can read.

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

Does '+' even concatenate in php? Try this:

 

<?php
$showname = $_GET['show'];
require_once 'magpierss/rss_fetch.inc';
$url = 'http://fromefm.co.uk/archive/dircaster2.php?show='.$showname;
$rss = fetch_rss($url);
foreach ($rss->items as $item ) {
$title = $item[title];
$url = $item[guid];
$description = $item[description];
echo "<li><a href='#' data-src='$url'>$title</a></li>
";
}
?>

  • Author

Awsome! Thanks. I was soooooooooooooooooooo close to being right lol. Schoolboy error :) Thanks very much

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

You are trying to concatenate two strings in the wrong way. In JavaScript you would indeed use a + sign, but in PHP the concatenation operator is a period. Change the line to this and it will work

 

$url = 'http://fromefm.co.uk/archive/dircaster2.php?show='.$showname;

 

... and I see the answer was already posted during me posting my response :P

Edited by Xena_Dragon

Xena_Dragon.png

  • Author

Now begins the challenge of turning all my experiments into a Wordpress plugin eek

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

  • Author

It's because I've been flicking between php and javascript for this blinkin html5 player I used a + instead of .

 

Now I understand how women get so stressful when you have a missing period.

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

  • Author

612d9da508.png

Mercifull.png

Mercifull <3 Suzi

"We don't want players to be able to buy their way to success in RuneScape. If we let players start doing this, it devalues RuneScape for others. We feel your status in real-life shouldn't affect your ability to be successful in RuneScape" Jagex 01/04/01 - 02/03/12

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.