Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

http_response from yahoo finance giving error

Fastfreddy Freeloader
Registered User
Join date: 19 Dec 2005
Posts: 29
01-29-2007 21:07
Hey all. Trying to pull data from quote.yahoo.com. When I send the URL below from a browser, I will get back a comma delimited list that has stock information about IBM (no HTTP headers or anything, just literally the comma separated values). When I try to get this information from SL, I get an error that says Object: Unsupported or unknown Content-Type. Does return information from HTTP servers have to have headers for SL? Tried looking in forums for help on this. Any help you could give would be appreciated. Thanks in advance.

URL:
http://quote.yahoo.com/d/quotes.csv?s=IBM&f=snd1t1l1gh

CODE:
CODE

key requestid;

default
{
state_entry()
{

}

touch_start(integer total_number)
{
requestid = llHTTPRequest("http://quote.yahoo.com/d/quotes.csv?s=IBM&f=snd1t1l1gh",[HTTP_METHOD,"GET"],"");
}
http_response(key request_id, integer status, list metadata, string body)
{
if (request_id == requestid)
{
llSay(0,body);
}
else
llSay(0,(string)status+" error");
}
}
Peekay Semyorka
Registered User
Join date: 18 Nov 2006
Posts: 337
01-30-2007 09:19
LSL can't handle the returned mime-type (application/octet-stream) even though the content is really just plain text.

Unless you can coerce Yahoo to return a different mime-type, you'll have to write a simple redirector on an external server (php/cgi/etc.) which fetches the quote for you and simply returns it with an acceptable mime-type (ie., text/plain or text/html).

-peekay
Fastfreddy Freeloader
Registered User
Join date: 19 Dec 2005
Posts: 29
01-30-2007 18:37
Thanks for the info. Hopefully the web server my webpage resides on will let me add the header.