View Full Version : small string problem

11-19-2007, 02:39 AM
Hi. I am trying to parse a list of RSS links through an RSS aggregator. The links are stored in a text file like this...


... the value of $currentLine when echoed gived the exact value of the RSS url, however the following line produces a "Error: RSS file not found" error...

if ($rs = $rss->get('$currentLine')){

If however I replace this line with the following, it works fine...

if ($rs = $rss->get('http://www.utilitycomputing.com/news/topten.xml')){

$feedlist = fopen("feedList.txt","r");
while (!feof($feedlist)) {
$currentLine = fgets($feedlist);
echo $currentLine."<br>";
if ($rs = $rss->get('$currentLine')){
// Title
echo "<h4><b><a href='$rs[link]'>$rs[title]</a></b></h4><br>";
// Description
echo "$rs[description]<br><br>";
}else {
die ('Error: RSS file not found...');

Is there a reason for this? because as far as I can see, this should work :(

11-19-2007, 03:19 AM
Variables in single quotes aren't parsed, so it's looking for a file called $currentLine. So, remove the quotes or use double-quotes.