PDA

View Full Version : Can't get Pausing RSS scroller to work.



Metalartin
05-02-2012, 04:10 AM
Script Title: Pausing RSS scroller

Script URL: http://www.dynamicdrive.com/dynamicindex17/rsspausescroller/index.htm

I'm building a website from local machine(the only way I can at the moment), I downloaded the files unzipped and tried the Demo out... it's not working it returned the message: "I give up trying to fetch RSS feed.".

Then I thought, it's PHP, I need to install something dont I? So I have downloaded and installed XAMPP and it says PHP should be working now but the Demo is still not functioning. The files were unziped into the websites main directory as is, so the URLs should be correct and they looked fine when I checked them.

I then went ahead with the setup instructions 1-4(adding the RSS feed I want and adding the domain to the allowed domains ect) but it still comes back with the same message.

I've spent ages trying to get this to work, it seems a nice script to have, so as a last resort before giving up on it I thought I'd ask here first.

Does anyone have any idea what could be wrong?

Metalartin
05-02-2012, 04:50 PM
Ok I see where I was going wrong... never used XAMPP before, ok after moving the directory to XAMPPS "htdocs" directory and typing "http://127.0.0.1/Website/demo.htm" manually in my browser, then updating the links, the message has changed.

Now it returns: "This domain isn't authorized to show scroller.
I give up trying to fetch RSS feed."

*.htm

<script type="text/javascript">
new rsspausescroller("cnn", "pscroller2", "rssclass", 3000, "_new", "date+description")
</script>
rsspausescroller.js

//URL to "scrollerbridge.php" on your server (use absolute path for syndication):
var bridgepath="//URL to "scrollerbridge.php" on your server (use absolute path for syndication):
var bridgepath="http://127.0.0.1/Website/lastrss/scrollerbridge.php"
scrollerbridge.php

// include lastRSS
include "lastRSS.php"; //path to lastRSS.php on your server relative to scrollerbridge.php

// Create lastRSS object
$rss = new lastRSS;
$rss->cache_dir = 'cache'; //path to cache directory on your server relative to scrollerbridge.php. Chmod 777!
$rss->date_format = 'M d, Y g:i:s A'; //date format of RSS item. See PHP date() function for possible input.
$rss->cache_time = 1800; //Global cache time before fetching RSS feed again, in seconds.

// Define your list of RSS URLs- "RSS_id"=> "URL to RSS feed"
$rsslist=array(
"cnn" => "http://rss.cnn.com/rss/cnn_topstories.rss",
"dynamicdrive" => "http://www.dynamicdrive.com/export.php?type=new",
"falingehub" => "http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=falingehub",
);

//Domains that are authorized to display scroller:
//Seperate multiple domains each with a comma (",")
//For example: $allowedDomains="dynamicdrive.com, javascriptkit.com"
//OR enter a blank string to allow any domain (ie: for RSS feed syndication):
$allowedDomains="cnn.com, dynamicdrive.com, twitter.com";

////Beginners don't need to configure past here///

Have I entered the domains correctly? Perhaps there is a setting in XAMPP preventing it from functioning fully if the code here is good? Anyone able to help?

jscheuer1
05-03-2012, 03:57 PM
The main problem there is that you're not allowing your own domain. Leave that blank, change:


$allowedDomains="cnn.com, dynamicdrive.com, twitter.com";

to:


$allowedDomains="";

There could also be other problems though. That script is way outdated and doesn't handle UTF-8 well. It also has other problems. Here's my latest revision:

4448

Metalartin
05-03-2012, 07:34 PM
The main problem there is that you're not allowing your own domain. Leave that blank, change:


$allowedDomains="cnn.com, dynamicdrive.com, twitter.com";

to:


$allowedDomains="";

There could also be other problems though. That script is way outdated and doesn't handle UTF-8 well. It also has other problems. Here's my latest revision:

4448

Thankyou for replying. :)

Yep I started off with that value blank but took the return value to mean I needed them in there, I've since tried using UniServer instead(alot more user friendly) aswell as hosting the demo files on my webspace which I've since found out does support PHP now.

I will take a look at your updated files, thanyou for that.

I'm wondering if the problem might be a little less obvious, may be a guess but I'm wondering if there is block on my end somewhere along the line preventing some functions, could my ISP be getting in the way of anything? Im logged on in an administrator account but not the default one(read its better not to use that all the time). I found the PHP file linked from the article and used that link in my local rsspausescroller.js and it worked instantly.

This PHP stuff is tricky no? and to think I was thinking of adding dynamic update features to some of the pages lol.

jscheuer1
05-04-2012, 12:39 AM
PHP can be tricky, but like HTML or javascript, once you understand the basics, it's fairly easy to do simple things and also fairly easy to install a working example of more complex things such as the archive I attached - it's fully functional as is.

I use WAMP as a local PHP host - it's not even live on the web, but it does have access to the internet, which is very similar to XAMP so, unless like you speculate, there's some problem with your ISP, it should be fine.

Double check that your XAMP local host server is working though. Make up a file, call it info.php:


<?php
phpinfo();
?>

and put it on your XAMP server, navigate to it. It should list a lot of information about the PHP version in use. If that works, test that you have access to the internet via your XAMP server. Make another file, call it external.php:


<?php
include 'http://www.google.com/';
?>

It should show you the Google home page. Images will be missing though because their paths are wrong.

If that works, then there shouldn't be any problems.

Metalartin
05-04-2012, 08:54 AM
Hi again, I tried all I could think of and.... well I'm well and truly stumped as to what the problem is seems like most people can just edit the paths and it works except me.

Im using UniServer(easier to configure than XAMP, I've tried changing the the short open tags etc.) it showed the google page fine when browsing from local machine.

I also removed the read only rights to all the files in lastrss' directory. I did notice that there are files in the cache folder(confirmed by deleting and refreshing page) so that means the paths are right does it not? Yet it displays it gives up trying to fetch the RSS feed still.

I've since uploaded both versions of the demo to my webspace for you to look at if you have the time. Atleast if I can get it working on there, theres a good chance I can get it running on what ever server the site ends up on.

Original Demo from Article Link (http://www.rockernumber1.webspace.virginmedia.com/demo1.htm)

Updated Simplepie version link (http://www.rockernumber1.webspace.virginmedia.com/demo2.htm)

If I cant do that I suppose there's the gajax rss pausing scroller which I've tried but it needs a Key if Im understanding right the page to get the key is gone, plus we don't know which server/address it will be on yet either. For now I have backed up the file with pausing Scroller code in and placed a crappy rsspump static one that doesnt seem to refresh let alone scroll, it's better than nothing but its hopefully a temporary measure.

jscheuer1
05-04-2012, 02:57 PM
On the simplepie link in your post, the simplepie/simplepie.inc and simplepie/scrollerbridge.php files are 404 Not Found. And I thought you said that your server wasn't PHP enabled. It won't work under those circumstances. If that's a different server or you've enabled PHP on it, you need to upload the the simplepie folder and its contents to the server.

Similarly on the server for the lastRSS version, the lastrss/lastRSS.php and lastrss/scrollerbridge.php files are 404 Not Found.

On XAMP, with the simplepie version, I inadvertently left two files in the cache. They should be removed, but probably won't hurt anything. They are:

c1385094608a6ceb6b8a3d25a2a8ae2e04c3ebd2.spc

and:

eefa557114bed3785cb5d2860eb7fb4e347ac960.spc

If those are the two files you have, they were already there.

About the gajax rss pausing scroller, the key is no longer required. Where it says to put:



<script type="text/javascript" src="http://www.google.com/jsapi?key=YOUR-API-KEY"></script>

All you need is:


<script type="text/javascript" src="http://www.google.com/jsapi"></script>

Metalartin
05-04-2012, 04:32 PM
Hi jscheuer1,

I was a little tired when I wrote that post so maybe I wasnt that clear(still am really, too many late nights recently).

Yes PHP is enabled on virginmedia, I've uploaded an info PHP if thats any use to you. Also its weird but I got that error too trying to browse to the files(they must have some odd permission settings, everything looks ok in the FTP client but that requires password obviously), they are deffinately there though, two directories named rss1 and rss2 for each version. I suppose the error message on its own is not much good?

I deleted the files you mentioned in the cache first, then ran it again and two new ones were put in there, this happened on both versions of the demo if I remember rightly, which suprised me.

Since it seems subdirectories on my webspace have special permission I have put everything in root for the simplepie version for you. It was the original file that came back with this message:



"Sorry: It's not possible to reach RSS file http://www.dynamicdrive.com/export.php?type=new
I give up trying to fetch RSS feed."

This seems more promising as it sounds to me like it nearly finnished reading the PHP script(isn't that value/argument near the bottom?).

Info.php (http://www.rockernumber1.webspace.virginmedia.com/info.php) (note this site wont be going on my webspace its for someone else, they did ask for an rss feed of their twitter at the top too).

Demo2 all in htdocs root (http://www.rockernumber1.webspace.virginmedia.com/demo.htm)

edit:
<script type="text/javascript" src="http://www.google.com/jsapi"></script>

Yep I saw that message about not needing keys but after trying that link in the code and it not working I'd assumed the one in the article used a different version that still requires keys(it says some still require them too). To be honest I'd much rather have this script but I will have a proper go at the gajax scroller tomorrow if I cant find a solution tonight to the problems Im having with it.

Metalartin
05-04-2012, 05:15 PM
Ah well after moving the files it and running it, it seems like trying to run the whole lot in the same directory is even worse, no cache files created.

Heres two cache files I've just got from localhost with Uniserver though:

1: rsscache_4a557f2f685dba25493c4f53092d421c = 10.9 KB
2: rsscache_eaa0bf19ea33700ed447204239c28d2e = 8.57 KB

Since I cant upload them I thought I'd post the first part of the code for 1 of them here if it helps(let me know if this isnt allowed and I will delete it):


a:14:{s:8:"encoding";s:10:"ISO-8859-1";s:5:"title";s:7:"CNN.com";s:4:"link";s:39:"http://www.cnn.com/?eref=rss_topstories";s:11:"description";s:124:"CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more.";s:8:"language";s:5:"en-us";s:9:"copyright";s:35:" 2012 Cable News Network LP, LLLP.";s:13:"lastBuildDate";s:23:"Jan 01, 1970 1:00:00 AM";s:11:"image_title";s:7:"CNN.com";s:9:"image_url";s:67:"http://i2.cdn.turner.com/cnn/.element/img/1.0/logo/cnn.logo.rss.gif";s:10:"image_link";s:39:"http://www.cnn.com/?eref=rss_topstories";s:11:"image_width";s:3:"144";s:12:"image_height";s:2:"33";s:5:"items";a:6:{i:0;a:5:{s:5:"title";s:42:"Possible breakthrough for Chinese activist";s:4:"link";s:66:"http://rss.cnn.com/~r/rss/cnn_topstories/~3/_K5ftN95XRA/index.html";s:11:"description";s:1421:"The State Department says Chen Guangchen has been offered a fellowship at a university in the U.S. and that China has indicated it will approve his travel documents.&lt;div class="feedflare"&gt;


Edit: The files created on my webspace are much smaller suggesting the script ends alot sooner than on from localmachine, the only thing either file contained was: "b:0;" Then blank.

jscheuer1
05-05-2012, 04:35 AM
So you're saying it's working on the local machine?

Either way, it seems as though one or more of the files on the server are either missing or don't have the proper permissions set.

Metalartin
05-05-2012, 08:57 AM
Well on local machine its displaying: "I give up trying to fetch the RSS feed" but on both versions of the demo the cache is being filled(two files), I've confirmed it again this morning.

As for running from my webspace only the old version of the demo begins caching anything(but as I said the files are pretty much empty). I may have to visit their support forum and ask them to take a look at whats wrong for me for future reference.

I will concentrate on getting it running from local machine since we know its atleast getting the cache files, its just not doing anything with them.

Metalartin
05-09-2012, 10:34 AM
Ok I'm back on this task after taking a few days off, going to be concentrating on using Uniform Server to get this running since I know it was caching with that.

I have since located the PHP error log with Uniform Server but I have no idea if the information is useful enough to locate the problem.

The original demo throws out these errors in the log:

PHP Notice: Undefined index: lastBuildDate in C:\\UniServer\\www\\lastrss\\lastRSS.php on line 159, referer: http://localhost/demo.htm

[Tue May 08 18:33:53.438600 2012] [:error] [pid 3144:tid 1068] [client ::1:49978] PHP Notice: Use of undefined constant link - assumed 'link' in C:\\UniServer\\www\\lastrss\\scrollerbridge.php on line 72, referer: http://localhost/demo.htm

[Tue May 08 18:33:53.439600 2012] [:error] [pid 3144:tid 1068] [client ::1:49978] PHP Notice: Use of undefined constant title - assumed 'title' in C:\\UniServer\\www\\lastrss\\scrollerbridge.php on line 72, referer: http://localhost/demo.htm

The simplepie version throws out these errors:


[Sat May 05 09:51:58.284800 2012] [:error] [pid 4524:tid 1072] [client ::1:49219] PHP Strict Standards: Non-static method SimplePie_Misc::change_encoding() should not be called statically, assuming $this from incompatible context in C:\\UniServer\\www\\rssps\\simplepie\\simplepie.inc on line 5126, referer: http://localhost/rssps/demo.htm

[Sat May 05 09:51:58.284800 2012] [:error] [pid 4524:tid 1072] [client ::1:49219] PHP Strict Standards: Non-static method SimplePie_Misc::encoding() should not be called statically, assuming $this from incompatible context in C:\\UniServer\\www\\rssps\\simplepie\\simplepie.inc on line 2790, referer: http://localhost/rssps/demo.htm

[Sat May 05 09:51:58.284800 2012] [:error] [pid 4524:tid 1072] [client ::1:49219] PHP Strict Standards: Non-static method SimplePie_Misc::encoding() should not be called statically, assuming $this from incompatible context in C:\\UniServer\\www\\rssps\\simplepie\\simplepie.inc on line 2791, referer: http://localhost/rssps/demo.htm

Is this specifically telling me whats wrong? Can it be fixed?

jscheuer1
05-09-2012, 10:57 AM
Those are version and/or setting specific notices and warnings in PHP.

I'm familiar with the first set, the undefined constant notices. Those literally mean that those words on those lines should be quoted.

The second set of strict errors I'm not familiar with. Perhaps someone in the PHP forum would be. I'm pretty sure they can be rewritten to be in compliance with strict standards. However, I see in other similar reports that turning off strict error reporting in php.ini can fix it.

See responses to:

http://forum.status.net/discussion/1575/after-i-install-the-statusnet-with-xampp-errors-show-like-this-in-the-home

for more info. Particularly the observation and suggestion by pmolendijk in that thread. That should take care of both sets of problems.

Metalartin
05-09-2012, 12:53 PM
Ah I give up, I tried the suggestion there adding it to all modes too.

Just spent 20mins getting gajax script to work and its up and running now, I have one question though, although its no fault of the script.

Twitter RSS Feed (http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=falingehub)

You may notice that the title has included the description in it(thats just a problem with twitter since they dont officially support it rss feeds I think)which totally messes up the format if you wanted to have both a title and a description. Are there any options to set the title length or anything like that so it won't display the description in it? That would solve it I think.

edit: Found the answer in another thread by the looks of it > gAjax RSS Ticker - title too long in IE7 (http://www.dynamicdrive.com/forums/showthread.php?t=24999), thanks for your help on all of the above anyway John. :)

Metalartin
05-09-2012, 02:47 PM
I realise this is for another script but didnt think it was worth creating a new thread for.

The only thing I want to do is set the description length but for some reason it seems to max out at 130 characters.


var itemtitle="<a href=\"" + feedslice[i].link + "\" target=\"" + linktarget + "\" class=\"titlefield\">" + feedslice[i].title.substring(0, 11) + "</a>"
var itemlabel=/label/i.test(showoptions)? '<span class="labelfield">['+feedslice[i].ddlabel+']</span>' : " "
var itemdate=gfeedfetcher._formatdate(feedslice[i].publishedDate, showoptions)
var itemdescription=/description/i.test(showoptions)? "<br />"+feedslice[i].content.substring(11, 200) : /snippet/i.test(showoptions)? "<br />"+feedslice[i].contentSnippet.substring(11, 200) : ""
rssoutput+=itemcontainer + itemtitle + " " + itemlabel + " " + itemdate + "\n" + itemdescription + itemcontainer.replace("<", "</") + "\n\n"
}
rssoutput+=(itemcontainer=="<li>")? "</ul>\n" : ""
return rssoutput
}


Its not a big problem but theres free space(about 1 and a half lines) in the container so I might aswell use it if possible.

jscheuer1
05-09-2012, 03:36 PM
The way it's set now, if that's the code that's doing it, this line:



var itemdescription=/description/i.test(showoptions)? "<br />"+feedslice[i].content.substring(11, 200) : /snippet/i.test(showoptions)? "<br />"+feedslice[i].contentSnippet.substring(11, 200) : ""

controls that, it's set to 189 characters. You can increase it by increasing the number 200 (two places). Or if you want the entire balance of content/contentSnippet, remove the 200 and it's preceding comma (also two places). The 11 should remain as those 11 chars have presumably already been used for the title.

Metalartin
05-09-2012, 04:24 PM
Sorry thats the value I wanted(already tried to increase that value to 200, it wasn't set before), Ive already got the title limited to 11 chars I was hoping to increase the description length but it wont reach 200 for some reason(I counted 125 from a copy and paste).

I was wondering if there is another setting elsewhere thats limiting it(don't think its my margins or padding, tried to check that and couldnt find anything that altered it). It doesn't really matter if not, I could always resize the container so the free space isnt showing, as a last resort.