Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

A question on HTTPRequest

Archanox Underthorn
Registered User
Join date: 20 May 2003
Posts: 168
09-11-2006 08:38
Hey guys, I've been having some oddness happening with my HTTPRequest calls and I'm figuring it must just be something that I'm doing wrong. Lemme post my function call:

requestid = llHTTPRequest(URL, [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "";);

The oddness is that just last night this started working (it didnt originally), and this morning when I tried it again, "The requested URL could not be retrieved". URL is the url of the php script followed by a list of &key=value pairs. I'm dumping the string to chat right before the call and when I manually put it into my web browser it works fine. So am I doing something wrong here?
_____________________
Archatek

Home to some of the highest quality katanas and other blades available in SL. Co-creator of the Samurai Island Combat System, one of the best melee combat systems available, come check it out!

___________________
Tuach Noh
Ignorant Knowlessman
Join date: 2 Aug 2006
Posts: 79
09-11-2006 15:05
What HTTP status code are you getting back in the http_response() event handler?

Also, check your web server logs to see if they show the access.
Archanox Underthorn
Registered User
Join date: 20 May 2003
Posts: 168
09-11-2006 19:40
Ah ok, after some messing around I at least determined that its an issue with the webserver, since I can access pretty much anything else besides my own address. The status code I get is 503 - Service Unavailable. I can't seem to find the attempts in the access logs either. Any ideas why it would flash me that error on an httprequest but work fine in a browser?
_____________________
Archatek

Home to some of the highest quality katanas and other blades available in SL. Co-creator of the Samurai Island Combat System, one of the best melee combat systems available, come check it out!

___________________
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
09-11-2006 22:59
I'm not an expert in the HTTP protocol, but you aren't actually posting anything. Perhaps your program/webserver is upset that you're effectivly posting a form with no data?
Patch Lamington
Blumfield SLuburban
Join date: 2 Nov 2005
Posts: 188
10-21-2006 16:27
im certainly no expert in this area... but doesnt POST data go in the body?

anyone got an example of a working POST lsl script, Im having problems getting it to work... and not sure if im screwing up the LSL or php end of things.
_____________________
Blumfield - a regular everyday kind of 'burb in an irregular world.
This notice brought to you by the Blumfield Visitors and Residents Bureau.
Chambers Charles
Registered User
Join date: 23 Oct 2006
Posts: 1
10-24-2006 06:27
I am just starting with LSL, but I have this working:

CODE

key myRequestId;

default
{
touch_start(integer number)
{
myRequestId = llHTTPRequest(
"http://www.example.com/2L.php",
[HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],
"param=test"
);
}


http_response (key request_id, integer status, list metadata, string body) {
if(request_id == myRequestId) {
llWhisper(0, body);
}
}
}
Pete Fats
Geek
Join date: 18 Apr 2003
Posts: 648
10-24-2006 13:59
From: Archanox Underthorn
when I manually put it into my web browser it works fine. So am I doing something wrong here?


If you are manually entering the URL into the address bar of your browser, you are performing a HTTP GET, not POST. Try changing that.
_____________________
Patch Lamington
Blumfield SLuburban
Join date: 2 Nov 2005
Posts: 188
10-25-2006 01:57
From: Chambers Charles
I am just starting with LSL, but I have this working:


thanks Chambers,
i did get it solved with a little help from a friend - though you beat me to putting a solution example up.

i might have done better if i hadnt inserted stupid typos along the way...
_____________________
Blumfield - a regular everyday kind of 'burb in an irregular world.
This notice brought to you by the Blumfield Visitors and Residents Bureau.
Archanox Underthorn
Registered User
Join date: 20 May 2003
Posts: 168
10-25-2006 08:34
Man Pete I wish you had caught this thread earlier, took me a while to figure that out on my own hehe. Thanks for the reply.
_____________________
Archatek

Home to some of the highest quality katanas and other blades available in SL. Co-creator of the Samurai Island Combat System, one of the best melee combat systems available, come check it out!

___________________
Earadriede Callisto
Registered User
Join date: 11 Mar 2006
Posts: 14
01-28-2007 09:34
is it possible to put the http_response in a function?

I want to call the function from a dialog.
Stylez Gomez
Union Micro
Join date: 4 Jun 2004
Posts: 146
01-28-2007 10:20
From: Earadriede Callisto
is it possible to put the http_response in a function?

I want to call the function from a dialog.


You can put "llHTTPRequest(...)" in a custom function, but not the actual "http_response" event handler.
_____________________
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-28-2007 10:25
From: Earadriede Callisto
is it possible to put the http_response in a function?

I want to call the function from a dialog.


You cannot 'call' http_responce, its an event handler. You dont know when , or even if, you will get a responce. You just have to wait for it to arrive.

Do you mean you want to display the results in a dialog? Just call llDialog from within the http_responce handler once you have the data.
Earadriede Callisto
Registered User
Join date: 11 Mar 2006
Posts: 14
01-29-2007 01:17
ah ok. thanks.