Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

http response RSS

Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
12-20-2007 16:18
Trying to look at an RSS feed. I know there will be lots of hurdles along the way (that's part of the fun, ain't it?), but I'm getting stymied right at step number 1.

What I'm getting is this:

[16:14] test box: entered http response
[16:14] test box: Unsupported or unknown Content-Type.


Here's the script; you'll see some of the various feeds I've been trying to make sure it's not just a problem with one feed.

//string RSSLink = "http://www.practicallyedible.com/edible.nsf/rssfeed.xml";
//string RSSLink = "http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml";
string RSSLink = "http://secondlife.reuters.com/stories/category/second-life/feed/atom";
key http_request_id;


default {

state_entry() {
http_request_id = llHTTPRequest(RSSLink, [], "";);
}

http_response(key request_id, integer status, list metadata, string body) {

if (request_id == http_request_id) {
llSay(0, "entered http response";);
list titles = llParseString2List(body,["<title>", "</title>"],[]);
llSay(0, llList2String(titles,0));
}
}
}
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
12-20-2007 16:55
chances are that adding the following would be helpful:

llHTTPRequest(RSSLink, [HTTP_METHOD,"GET"], "";);

or maybe:

llHTTPRequest(RSSLink, [HTTP_METHOD,"GET", HTTP_MIMETYPE, "text/plain;charset=utf-8"], "";);

If the provided charset from the RSS-Feed is different, use the according one (i.e. iso-8859-1)

Be aware, that you'll only get 2KB of data with this request which most likely will not be enough to display even one entry. You might be better off, if you'd be able to pull the RSS-Data to a php-script, parse/split the results and then send them back to SL...
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
12-20-2007 17:13
From: Haruki Watanabe
chances are that adding the following would be helpful:

llHTTPRequest(RSSLink, [HTTP_METHOD,"GET"], "";);

or maybe:

llHTTPRequest(RSSLink, [HTTP_METHOD,"GET", HTTP_MIMETYPE, "text/plain;charset=utf-8"], "";);

If the provided charset from the RSS-Feed is different, use the according one (i.e. iso-8859-1)

Be aware, that you'll only get 2KB of data with this request which most likely will not be enough to display even one entry. You might be better off, if you'd be able to pull the RSS-Data to a php-script, parse/split the results and then send them back to SL...


Thats the largest hurdle in llHttprequest- you can only pull out the first 2kb of data. For an rss feed, that won't be enough for sure.
_____________________
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
12-20-2007 20:43
>> llHTTPRequest(RSSLink, [HTTP_METHOD,"GET"], "";);

nope doesn't change error result

>> llHTTPRequest(RSSLink, [HTTP_METHOD,"GET", HTTP_MIMETYPE, "text/plain;charset=utf-8"], "";);

nope doesn't change error result

(actually had tried them both before, sorry i should have said but was late for going out for RL dinner.)


>>> Thats the largest hurdle in llHttprequest- you can only pull out the first 2kb of data

hmm. damn okay i'm losing my mind... i saw stuff referring to the 2048 k then saw stuff referring to 4k so i figured, okay, given that there's 17 different wikis floating around, i guess the 2048 number is old and the 4k number is newer -- and of course I can't now for the life of me find the stuff referring to 4k to prove that I actually saw it as opposed to imagining it...

if it's really still 2k, which i'm gather it is, then, how cow.... no way this being used for RSS LOL. Hell easier to scan the stuff in and upload it, LOL.

but still i'm curious, is the reason it's saying invalid content because the content is 3.5 k on one of the rss feeds (just counted.)
bucky Barkley
Registered User
Join date: 15 May 2006
Posts: 200
12-20-2007 21:04
The method that will give you the most flexibility is to parse the feed on an intermediate web site, and to poll that site for a simplified stream that will be more suitable for SL (i.e. lose the XML baggage)

If you are doing PHP, check out SimplePie for parsing RSS feeds:
http://simplepie.org/
_____________________
Bucky Barkley -- Mammal, Scripter, Builder, Lover
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
12-20-2007 21:16
yeah, i saw that stuff about parsing...

means there always has to be a middleman....

i guess that's no biggie, more and more stuff in Sl these days requires external processing...

i'd prolly be lazy and use IBM domino instead of PHP, cause I can whip through that stuff in 20 secs
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
12-20-2007 22:02
this looks interesting, too:

ExchangeSecondSimpleSyndication

http://rpgstats.com/wiki/index.php?title=ExchangeSecondSimpleSyndication

created it seems by our forebears in all this, the Old-Timers.
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
12-27-2007 15:18
fyi to those searching in future, turns out that:

"Unsupported or unknown Content-Type."

can also equal "too much for the memory" in Lindenese

as it proved to be in this case.

Gah, we thought the 16k script memory limit was tough, this 2k http response limit is really fun in comparison! LOL.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-27-2007 23:31
From: Chaz Longstaff
Gah, we thought the 16k script memory limit was tough, this 2k http response limit is really fun in comparison! LOL.

but only for large values of 'fun' =X
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -