So, I'm working for the first time with embedding a RSS (or atom, but right now I'm trying to stick to rss) feed from my Remember the Milk account in my own website. (Eventually, there will be an at a glance dashboard style thing.) Now, like I said, this is pretty much my first time actually working with rss feeds. I've been using Magpie RSS, and whenever I give it a url to fetch, it errors out saying:
Warning: MagpieRSS: fetch_rss called without a url in /magpierss/rss_fetch.inc on line 238
Warning: Invalid argument supplied for foreach() in dash.php on line 53
So, from this I conclude that my URL is wrong. However, this is the RSS feed url supplied by RTM, and which works just fine in my google reader. So, what am I screwing up?
Edit: The php I'm using to call rss_fetch:
<?php
require_once("php/magpierss/rss_fetch.inc");
$url = $_GET['http://www.rememberthemilk.com/rss/test.reeher/15418678/?tok=eJwNzccJw0AQAMCKzmwO5VzYxQa ZPWP9R*Y8JoFVAph3Zs26GIXmEgHkp3VUNsqZ1aK436o0Dm4JykGjLt*9*uqetc1vp- fPVAFwzwGpmLPbHYrPGws60j32koOa3vwbiKxgvVs9Ug-gVBuNpdk-AEX*ysp'];
$r开发者_JAVA技巧ss= fetch_rss( $url );
echo $rss->channel['title'] . "<p>";
echo "<ul>";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
echo "<li><a href=$href>$title</a></li";
}
echo "</ul>";
?>
It's pretty much the example php from Magpie.
I'm fairly certain the following line
$url = $_GET['http://www.rememberthemilk.com/rss/test.reeher/15418678/?tok=eJwNzccJw0AQAMCKzmwO5VzYxQa ZPWP9R*Y8JoFVAph3Zs26GIXmEgHkp3VUNsqZ1aK436o0Dm4JykGjLt*9*uqetc1vp- fPVAFwzwGpmLPbHYrPGws60j32koOa3vwbiKxgvVs9Ug-gVBuNpdk-AEX*ysp'];
should be
$url = 'http://www.rememberthemilk.com/rss/test.reeher/15418678/?tok=eJwNzccJw0AQAMCKzmwO5VzYxQa ZPWP9R*Y8JoFVAph3Zs26GIXmEgHkp3VUNsqZ1aK436o0Dm4JykGjLt*9*uqetc1vp- fPVAFwzwGpmLPbHYrPGws60j32koOa3vwbiKxgvVs9Ug-gVBuNpdk-AEX*ysp';
$_GET is an array of all the query string parameters passed to the php script, for example if you had the following url
http://example.com/test.php?a=foo&b=bar
in the test.php script
$_GET['a'] == 'foo'
$_GET['b'] == 'bar'
Yes, that's not the functionality of $_GET. The $_GET superglobal looks at the current requested URL to parse and retrieve variables. Also, getting the variable from the URL would make no sense even if it did work. $_GET['key'] would grab 'value' in the URL query '?key=value'.
精彩评论