Go Back   SL Forums > Resident Forums > Content Creation > Scripting Tips
Welcome, Al Supercharge.
You last visited: 05-07-2008 at 06:33 AM
User CP GUIDELINES - please read before posting New Posts Quick Links Log Out


Reply
Thread Tools Search this Thread Display Modes
Old 04-24-2008, 06:54 AM   #1
Maui Capalini
Registered User

Join Date: Feb 2008
Posts: 3
Alternate to llHTTPRequest? Lower level plaintext?

I know llHTTPRequest has problems with RSS feeds, amongst other complex web content.. is there an alternate method to just receive the stream as plain text? I don't mind doing the parsing in LSL, but I don't know how to get the HTML without all the complications (and failings) of llHTTPRequest.
Maui Capalini is offline Report Bad Post   Reply With Quote
Old 04-24-2008, 08:15 AM   #2
Ordinal Malaprop
really very ordinary

Join Date: Sep 2005
Location: Caledon
Posts: 4,230
You _are_ receiving the response as plain text - that's the problem.

llHTTPRequest will only receive what it gets as a response, there is no option to "strip tags" or anything like that (which would be nice but seems unlikely to appear). The best solution I have found is to have your own server, with a proxy script in PHP or whatnot which reads the page that you want, parses it, and sends the information back to your LSL script. Then you call your proxy from LSL instead of the original page.

So, for example, instead of requesting a page with the latest cricket scores, you write a proxy which requests the page, parses it, grabs the cricket scores and turns them into a nice CSV or some such. Then your LSL script calls that proxy and gets only the information it needs.
Ordinal Malaprop is online now Report Bad Post   Reply With Quote
Old 04-24-2008, 08:34 AM   #3
Maui Capalini
Registered User

Join Date: Feb 2008
Posts: 3
Maybe I misunderstand something else then..? I've tried loading some XML pages from within SL, only to see "Unsupported or unknown Content-Type." If it were coming in as plaintext, shouldn't I just see the stream of XML?

For example, if I try to load the page [url]http://twitter.com/statuses/show/792410100.xml[/url] , I just get the error message. Putting that into my web browser properly shows the XML. Even looking at the page source shows nothing complicated. This makes me think llHTTPRequest is doing SOME type of pre-processing for the action to fail.
Maui Capalini is offline Report Bad Post   Reply With Quote
Old 04-24-2008, 01:29 PM   #4
Haruki Watanabe
llSLCrash(void);

Join Date: Mar 2007
Posts: 315
Don't know, whether this is working, but I had the same Problem calling some Radio-Stats page which is in XML-Format as well.
I had to do the call like this:

[php]
string url = "http://www.myshoutcastserver.com:8000/7.html HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n";

requestid = llHTTPRequest(url,[],"");
[/php]

The important part here is: HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n


HTH
Haruki Watanabe is online now Report Bad Post   Reply With Quote
Old 04-24-2008, 06:16 PM   #5
Hewee Zetkin
Registered User

Join Date: Jul 2006
Posts: 1,327
SL sends the HTTP request header "Accept: text/*". Maybe the web server is having an issue interpreting that, or maybe LSL is having an issue with the actual Content-Type the web server is sending back (e.g. "application/rss+xml"). If possible, you could setup your own little proxy script on your own web server to change the Content-Type header to "text/plain" and see if that makes a difference.
Hewee Zetkin is offline Report Bad Post   Reply With Quote
Old 04-24-2008, 07:45 PM   #6
Maui Capalini
Registered User

Join Date: Feb 2008
Posts: 3
Haruku, I tried adding the extra info to my URL string, but still no luck.

Hewee/Ordinal, as it is, I do have it setup to hit a proxy server which parses the XML for me, as it's the only way I've been able to get it to work. My original question was an attempt to avoid this method, and have SL get the information directly from the source.
Maui Capalini is offline Report Bad Post   Reply With Quote
Reply



Posting Rules
You may post new threads
You may post replies
You may post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump



All times are GMT. The time now is 10:24 PM.


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright 2002-2007 Linden Lab