<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Simba+Fuhr</id>
	<title>Second Life Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Simba+Fuhr"/>
	<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/wiki/Special:Contributions/Simba_Fuhr"/>
	<updated>2026-07-27T09:52:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Failsafename2key&amp;diff=1159497</id>
		<title>Failsafename2key</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Failsafename2key&amp;diff=1159497"/>
		<updated>2011-12-12T18:23:45Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This script is a example for a failsafe name2key lookup.&lt;br /&gt;
The script will return results also when some of the given providers are unavailable.&lt;br /&gt;
&lt;br /&gt;
Main Script:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list Servers = [&amp;quot;https://kubwa.de/_slworld/name2key.php?name=&amp;quot;,&lt;br /&gt;
                &amp;quot;http://w-hat.com/name2key?terse=1&amp;amp;name=&amp;quot;,&lt;br /&gt;
                &amp;quot;https://n2k.danardlabs.com/n2k_io.php?action=getkey&amp;amp;verbose=0&amp;amp;username=&amp;quot;,&lt;br /&gt;
                &amp;quot;http://kdc.ethernia.net/sys/name2key.php?name=&amp;quot;];&lt;br /&gt;
                &lt;br /&gt;
list LookUpQueue;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    link_message(integer Sender, integer Num, string Str, key ID)&lt;br /&gt;
    {&lt;br /&gt;
        if (ID == &amp;quot;Name2Key.Lookup&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            LookUpQueue = LookUpQueue + [llHTTPRequest(llList2String(Servers, 0) + llEscapeURL(Str),&lt;br /&gt;
                                                       [HTTP_METHOD, &amp;quot;GET&amp;quot;, HTTP_VERIFY_CERT, FALSE],&lt;br /&gt;
                                                       &amp;quot;&amp;quot;), 0, Str, Num, Sender];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    http_response(key Request, integer Status, list Meta, string Data)&lt;br /&gt;
    {&lt;br /&gt;
        integer Found = llListFindList(LookUpQueue, [Request]);&lt;br /&gt;
        if (Found &amp;gt; -1)&lt;br /&gt;
        {&lt;br /&gt;
            list Temp = llParseString2List(Data, [&amp;quot;,&amp;quot;, &amp;quot;;&amp;quot;, &amp;quot; &amp;quot;, &amp;quot;:&amp;quot;, &amp;quot;\n&amp;quot;, &amp;quot;|&amp;quot;], []);&lt;br /&gt;
            integer i;&lt;br /&gt;
            integer LoopFound = -1;&lt;br /&gt;
            for (i = 0; i &amp;lt; llGetListLength(Temp); ++i)&lt;br /&gt;
            {&lt;br /&gt;
                if (llStringLength(llList2String(Temp, i)) == 36 &amp;amp;&amp;amp; llList2Key(Temp, i) != NULL_KEY)&lt;br /&gt;
                 {LoopFound = i;}&lt;br /&gt;
            }&lt;br /&gt;
            if (LoopFound &amp;gt; -1)&lt;br /&gt;
            {&lt;br /&gt;
                llMessageLinked(llList2Integer(LookUpQueue, Found + 4), llList2Integer(LookUpQueue, Found + 3),&lt;br /&gt;
                                &amp;quot;Found&amp;quot;, llList2Key(Temp, LoopFound));&lt;br /&gt;
                LookUpQueue = llDeleteSubList(LookUpQueue, Found, Found + 4);&lt;br /&gt;
            }&lt;br /&gt;
            else&lt;br /&gt;
            {&lt;br /&gt;
                if (llList2Integer(LookUpQueue, Found + 1) + 1 &amp;lt; llGetListLength(LookUpQueue) - 1)&lt;br /&gt;
                {&lt;br /&gt;
                    LookUpQueue = llListReplaceList(LookUpQueue, [llHTTPRequest(llList2String(Servers,&lt;br /&gt;
                                                                                              llList2Integer(LookUpQueue,&lt;br /&gt;
                                                                                                             Found + 1) + 1) +&lt;br /&gt;
                                                                                llEscapeURL(llList2String(LookUpQueue, Found + 2)),&lt;br /&gt;
                                                                                [HTTP_METHOD, &amp;quot;GET&amp;quot;, HTTP_VERIFY_CERT, FALSE],&lt;br /&gt;
                                                                                &amp;quot;&amp;quot;), llList2Integer(LookUpQueue, Found + 1) + 1],&lt;br /&gt;
                                                    Found, Found + 1);&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    llMessageLinked(llList2Integer(LookUpQueue, Found + 4), llList2Integer(LookUpQueue, Found + 3),&lt;br /&gt;
                                    &amp;quot;Not-Found&amp;quot;, NULL_KEY);&lt;br /&gt;
                    LookUpQueue = llDeleteSubList(LookUpQueue, Found, Found + 4);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example usage:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llListen(1, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    listen(integer chan, string name, key id, string msg)&lt;br /&gt;
    {&lt;br /&gt;
        llMessageLinked(LINK_THIS, llRound(llFrand(9999)), msg, &amp;quot;Name2Key.Lookup&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    link_message(integer Sender, integer Num, string Str, key ID)&lt;br /&gt;
    {&lt;br /&gt;
        llOwnerSay((string)Sender + &amp;quot; =&amp;gt; &amp;quot; + (string)Num + &amp;quot;&amp;gt; &amp;quot; + Str + &amp;quot;: &amp;quot; + (string)ID);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For questions please ask Simba Fuhr in Second Life.&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Community_Web_Service_APIs&amp;diff=1147606</id>
		<title>Community Web Service APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Community_Web_Service_APIs&amp;diff=1147606"/>
		<updated>2011-06-27T06:53:57Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: Removed old, no longer existing webpage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below are listed third-party web-services and data-feeds provided by communities and businesses related to Second Life.&lt;br /&gt;
:Note: These services are not affiliated with Linden Lab in any way.&lt;br /&gt;
&lt;br /&gt;
Service providers should add their own entries with a brief description and link to further information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;BoxTiny.com&#039;&#039;&#039; - [http://boxtiny.com/ boxtiny.com] - Website with lists of textures indexed for search and download into SL. Comunity based and souported. All the textures are free and full perm. Look for register page to learn how to register.&lt;br /&gt;
* &#039;&#039;&#039;W-Hat projects&#039;&#039;&#039; - [http://w-hat.com w-hat.com] - An SL group/community that also provides avatar key lookup ([http://w-hat.com/name2key name2key]), persistent database store ([http://w-hat.com/httpdb httpdb]) services.&lt;br /&gt;
* &#039;&#039;&#039;Kubwa.net&#039;&#039;&#039; - [http://kubwa.net/?cmd=name2key Kubwa.net-Name2Key] - An API to allow Name2Key requests from the web or LSL. The database is bot supported and finds everyones key.&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Community_Web_Service_APIs&amp;diff=1147605</id>
		<title>Community Web Service APIs</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Community_Web_Service_APIs&amp;diff=1147605"/>
		<updated>2011-06-27T06:51:48Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below are listed third-party web-services and data-feeds provided by communities and businesses related to Second Life.&lt;br /&gt;
:Note: These services are not affiliated with Linden Lab in any way.&lt;br /&gt;
&lt;br /&gt;
Service providers should add their own entries with a brief description and link to further information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;BoxTiny.com&#039;&#039;&#039; - [http://boxtiny.com/ boxtiny.com] - Website with lists of textures indexed for search and download into SL. Comunity based and souported. All the textures are free and full perm. Look for register page to learn how to register.&lt;br /&gt;
* &#039;&#039;&#039;W-Hat projects&#039;&#039;&#039; - [http://w-hat.com w-hat.com] - An SL group/community that also provides avatar key lookup ([http://w-hat.com/name2key name2key]), persistent database store ([http://w-hat.com/httpdb httpdb]) services.&lt;br /&gt;
* &#039;&#039;&#039;Zidonuke&#039;s API&#039;&#039;&#039; - [http://api.zidonuke.com api.zidonuke.com] - A API for providing LSL scripts with very easy to parse information from various sources. (name2key, getprofile, and more)&lt;br /&gt;
* &#039;&#039;&#039;Kubwa.net&#039;&#039;&#039; - [http://kubwa.net/?cmd=name2key Kubwa.net-Name2Key] - An API to allow Name2Key requests from the web or LSL. The database is bot supported and finds everyones key.&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1147349</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1147349"/>
		<updated>2011-06-22T13:03:23Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://n2k.danardlabs.com (SSL, {{LSLGC|Legacy Name|Legacy Names}} &amp;amp; {{LSLGC|Username|Usernames}} supported)&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://kubwa.net/index.php?cmd=name2key (Bot based name2key Database; Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats; Shows related names; SSL support.)&lt;br /&gt;
*http://www.db4mv.info (Name2Key Database for Avatars ({{LSLGC|Legacy Name|Legacy Names}},{{LSLGC|Username|Usernames}}, and {{LSLGC|Display Name|Display Names}}, GroupNames and Keys, LSL API)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&amp;lt;/s&amp;gt; &amp;lt;font color=red&amp;gt;(Apez seems to be gone ? - May 2011)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
*[[Failsavename2key|Failsave name2key script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Failsafename2key&amp;diff=1147348</id>
		<title>Failsafename2key</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Failsafename2key&amp;diff=1147348"/>
		<updated>2011-06-22T13:01:45Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: Created page with &amp;quot;This script is a example for a failsafe name2key lookup. The script will return results also when some of the given providers are unavailable.  Main Script: &amp;lt;lsl&amp;gt; list Servers = …&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This script is a example for a failsafe name2key lookup.&lt;br /&gt;
The script will return results also when some of the given providers are unavailable.&lt;br /&gt;
&lt;br /&gt;
Main Script:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list Servers = [&amp;quot;https://kubwa.net/_slworld/name2key.php?name=&amp;quot;,&lt;br /&gt;
                &amp;quot;http://w-hat.com/name2key?terse=1&amp;amp;name=&amp;quot;,&lt;br /&gt;
                &amp;quot;https://n2k.danardlabs.com/n2k_io.php?action=getkey&amp;amp;verbose=0&amp;amp;username=&amp;quot;,&lt;br /&gt;
                &amp;quot;http://kdc.ethernia.net/sys/name2key.php?name=&amp;quot;];&lt;br /&gt;
                &lt;br /&gt;
list LookUpQueue;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    link_message(integer Sender, integer Num, string Str, key ID)&lt;br /&gt;
    {&lt;br /&gt;
        if (ID == &amp;quot;Name2Key.Lookup&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            LookUpQueue = LookUpQueue + [llHTTPRequest(llList2String(Servers, 0) + llEscapeURL(Str),&lt;br /&gt;
                                                       [HTTP_METHOD, &amp;quot;GET&amp;quot;, HTTP_VERIFY_CERT, FALSE],&lt;br /&gt;
                                                       &amp;quot;&amp;quot;), 0, Str, Num, Sender];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    http_response(key Request, integer Status, list Meta, string Data)&lt;br /&gt;
    {&lt;br /&gt;
        integer Found = llListFindList(LookUpQueue, [Request]);&lt;br /&gt;
        if (Found &amp;gt; -1)&lt;br /&gt;
        {&lt;br /&gt;
            list Temp = llParseString2List(Data, [&amp;quot;,&amp;quot;, &amp;quot;;&amp;quot;, &amp;quot; &amp;quot;, &amp;quot;:&amp;quot;, &amp;quot;\n&amp;quot;, &amp;quot;|&amp;quot;], []);&lt;br /&gt;
            integer i;&lt;br /&gt;
            integer LoopFound = -1;&lt;br /&gt;
            for (i = 0; i &amp;lt; llGetListLength(Temp); ++i)&lt;br /&gt;
            {&lt;br /&gt;
                if (llStringLength(llList2String(Temp, i)) == 36 &amp;amp;&amp;amp; llList2Key(Temp, i) != NULL_KEY)&lt;br /&gt;
                 {LoopFound = i;}&lt;br /&gt;
            }&lt;br /&gt;
            if (LoopFound &amp;gt; -1)&lt;br /&gt;
            {&lt;br /&gt;
                llMessageLinked(llList2Integer(LookUpQueue, Found + 4), llList2Integer(LookUpQueue, Found + 3),&lt;br /&gt;
                                &amp;quot;Found&amp;quot;, llList2Key(Temp, LoopFound));&lt;br /&gt;
                LookUpQueue = llDeleteSubList(LookUpQueue, Found, Found + 4);&lt;br /&gt;
            }&lt;br /&gt;
            else&lt;br /&gt;
            {&lt;br /&gt;
                if (llList2Integer(LookUpQueue, Found + 1) + 1 &amp;lt; llGetListLength(LookUpQueue) - 1)&lt;br /&gt;
                {&lt;br /&gt;
                    LookUpQueue = llListReplaceList(LookUpQueue, [llHTTPRequest(llList2String(Servers,&lt;br /&gt;
                                                                                              llList2Integer(LookUpQueue,&lt;br /&gt;
                                                                                                             Found + 1) + 1) +&lt;br /&gt;
                                                                                llEscapeURL(llList2String(LookUpQueue, Found + 2)),&lt;br /&gt;
                                                                                [HTTP_METHOD, &amp;quot;GET&amp;quot;, HTTP_VERIFY_CERT, FALSE],&lt;br /&gt;
                                                                                &amp;quot;&amp;quot;), llList2Integer(LookUpQueue, Found + 1) + 1],&lt;br /&gt;
                                                    Found, Found + 1);&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    llMessageLinked(llList2Integer(LookUpQueue, Found + 4), llList2Integer(LookUpQueue, Found + 3),&lt;br /&gt;
                                    &amp;quot;Not-Found&amp;quot;, NULL_KEY);&lt;br /&gt;
                    LookUpQueue = llDeleteSubList(LookUpQueue, Found, Found + 4);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example usage:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llListen(1, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    listen(integer chan, string name, key id, string msg)&lt;br /&gt;
    {&lt;br /&gt;
        llMessageLinked(LINK_THIS, llRound(llFrand(9999)), msg, &amp;quot;Name2Key.Lookup&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    link_message(integer Sender, integer Num, string Str, key ID)&lt;br /&gt;
    {&lt;br /&gt;
        llOwnerSay((string)Sender + &amp;quot; =&amp;gt; &amp;quot; + (string)Num + &amp;quot;&amp;gt; &amp;quot; + Str + &amp;quot;: &amp;quot; + (string)ID);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For questions please ask Simba Fuhr in Second Life.&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1144724</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1144724"/>
		<updated>2011-05-28T07:47:39Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://n2k.danardlabs.com (SSL, {{LSLGC|Legacy Name|Legacy Names}} &amp;amp; {{LSLGC|Username|Usernames}} supported)&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://kubwa.net/index.php?cmd=name2key (Bot based name2key Database; Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats; Shows related names; SSL support.)&lt;br /&gt;
*http://www.db4mv.info (Name2Key Database for Avatars ({{LSLGC|Legacy Name|Legacy Names}},{{LSLGC|Username|Usernames}}, and {{LSLGC|Display Name|Display Names}}, GroupNames and Keys, LSL API)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&amp;lt;/s&amp;gt; &amp;lt;font color=red&amp;gt;(Apez seems to be gone ? - May 2011)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1144723</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1144723"/>
		<updated>2011-05-28T07:46:50Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://n2k.danardlabs.com (SSL, {{LSLGC|Legacy Name|Legacy Names}} &amp;amp; {{LSLGC|Username|Usernames}} supported)&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://kubwa.net/index.php?cmd=name2key (Bot based name2key Database. Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats. Shows related names.)&lt;br /&gt;
*http://www.db4mv.info (Name2Key Database for Avatars ({{LSLGC|Legacy Name|Legacy Names}},{{LSLGC|Username|Usernames}}, and {{LSLGC|Display Name|Display Names}}, GroupNames and Keys, LSL API)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&amp;lt;/s&amp;gt; &amp;lt;font color=red&amp;gt;(Apez seems to be gone ? - May 2011)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1144176</id>
		<title>LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1144176"/>
		<updated>2011-05-20T09:52:32Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: /* Simple script for sending data to an LSL via PHP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}&lt;br /&gt;
=== Utility Script ===&lt;br /&gt;
A script intended as a &#039;fill in the blank&#039; exercise for very, very simple HTTP servers is here: [[LSL_http_server/examples/utility_script | Utility Script]]&lt;br /&gt;
=== Hello World! ===&lt;br /&gt;
Classic example, the smallest http_request script possible.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
A slightly more robust version:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Echo World ===&lt;br /&gt;
&amp;quot;Echo World ([[User:Byrd Sciavo|Byrd Sciavo]] 04:19, 7 October 2009 (UTC))&amp;quot; is a slightly more useful &amp;quot;Hello World&amp;quot;, demonstrating a basic server that echos back dynamic data fed. Echo World shows how http_request receives GET variables. To receive this &amp;quot;dynamic echo&amp;quot;, append your cap url with a query string, such as https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry(){&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body){    &lt;br /&gt;
        if (method == URL_REQUEST_GRANTED) {&lt;br /&gt;
            url=body;llOwnerSay(url);&lt;br /&gt;
        }else if(method==&amp;quot;GET&amp;quot;){&lt;br /&gt;
              if(llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;)==&amp;quot;&amp;quot;) llHTTPResponse(id,200,&amp;quot;I ECHO when you append some GET variables to me, e.g., /?var=foo&amp;quot;);&lt;br /&gt;
              else llHTTPResponse(id,200,llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;));&lt;br /&gt;
        }        &lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visitor List ===&lt;br /&gt;
A list of residents within sensor range of the server.&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
* This includes a method for handling multiple requests while waiting for asynchronous data requests to come back.&lt;br /&gt;
&amp;lt;lsl&amp;gt;integer scanning = FALSE;&lt;br /&gt;
&lt;br /&gt;
list requests;&lt;br /&gt;
&lt;br /&gt;
send_response(string body)&lt;br /&gt;
{&lt;br /&gt;
    integer j;&lt;br /&gt;
    for (j = 0; j &amp;lt; llGetListLength(requests); ++j)&lt;br /&gt;
    {&lt;br /&gt;
        llHTTPResponse(llList2Key(requests,j), 200, body);&lt;br /&gt;
    }&lt;br /&gt;
    requests = [];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            if (!scanning)&lt;br /&gt;
            {&lt;br /&gt;
                llSensor(&amp;quot;&amp;quot;,NULL_KEY,AGENT,96,PI);&lt;br /&gt;
                scanning = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            requests += [id];&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported method.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    no_sensor()&lt;br /&gt;
    {&lt;br /&gt;
        send_response(&amp;quot;There is no one here.&amp;quot;);&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    sensor(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        string output;&lt;br /&gt;
        if (n &amp;lt; 16) output = &amp;quot;There are &amp;quot; + (string)n + &amp;quot; avatars nearby:&amp;quot;;&lt;br /&gt;
        else output = &amp;quot;There are at least 16 avatars nearby:&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i = 0;i&amp;lt;n;++i)&lt;br /&gt;
        {&lt;br /&gt;
            output += &amp;quot;\n\t&amp;quot; + llDetectedName(i);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        send_response(output);&lt;br /&gt;
&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Url Persistence / Visitor Counter ===&lt;br /&gt;
A more complete &#039;hello world&#039;, always has an url and keeps a visitor counter.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
integer hits;&lt;br /&gt;
&lt;br /&gt;
setup()&lt;br /&gt;
{&lt;br /&gt;
    llSetObjectName(&amp;quot;HTTP Server&amp;quot;);&lt;br /&gt;
    url = &amp;quot;&amp;quot;;&lt;br /&gt;
    llRequestURL();&lt;br /&gt;
    hits = (integer)llGetObjectDesc();&lt;br /&gt;
    llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { setup(); }&lt;br /&gt;
    on_rez(integer n) { setup(); }&lt;br /&gt;
    &lt;br /&gt;
    changed(integer c)&lt;br /&gt;
    {&lt;br /&gt;
        if (c &amp;amp; (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )&lt;br /&gt;
        {&lt;br /&gt;
            setup();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    touch_start(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;My url is: &amp;quot; + url);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            url = body;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            ++hits;&lt;br /&gt;
            llSetObjectDesc((string)hits);&lt;br /&gt;
            llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello!  You are visitor &amp;quot; + (string)hits + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Method unsupported&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid.  ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL();     // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
     http_request(key id, string method, string body) {&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information from the outside: &amp;quot; + body);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Thank you for calling. All of our operators are busy.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the PERL script to contact the prim on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
    # First get the arguments.&lt;br /&gt;
    my $url = shift;&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    # Create the objects to be used to send out the HTTP request&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);&lt;br /&gt;
&lt;br /&gt;
    # Set the encoding method and specify the information to be sent.&lt;br /&gt;
    $request-&amp;gt;content_type(&#039;application/x-www-form-urlencoded&#039;);&lt;br /&gt;
    $request-&amp;gt;content(uri_escape($information));&lt;br /&gt;
&lt;br /&gt;
    # Send the request.&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);&lt;br /&gt;
&lt;br /&gt;
    # Return the information sent back&lt;br /&gt;
    return($response-&amp;gt;content);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,&#039;id=244195d6-c9b7-4fd6-9229-c3a8b2e60e81&amp;amp;name=M Linden&#039;);&lt;br /&gt;
&lt;br /&gt;
print $info,&amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the Python code that does the same thing as the PERL code above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    # Set the parameters to be sent.&lt;br /&gt;
    encodedParams =  urllib.urlencode(parameters);&lt;br /&gt;
&lt;br /&gt;
    # Post the data.&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);&lt;br /&gt;
&lt;br /&gt;
    # return the result.&lt;br /&gt;
    return(net.read());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;}&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST With Argument Parsing ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. In this example the scripts are adapted to handle the parsing of the arguments that are passed. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid. ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
// ###############################################&lt;br /&gt;
// Routine to parse a string sent through the &lt;br /&gt;
// http server via post.&lt;br /&gt;
//       parsePostData(theMessage)&lt;br /&gt;
// Returns a strided list with stride length 2.&lt;br /&gt;
// Each set has the key and then its value.&lt;br /&gt;
list parsePostData(string message) {&lt;br /&gt;
    list postData = [];         // The list with the data that was passed in.&lt;br /&gt;
    list parsedMessage = llParseString2List(message,[&amp;quot;&amp;amp;&amp;quot;],[]);    // The key/value pairs parsed into one list.&lt;br /&gt;
    integer len = ~llGetListLength(parsedMessage);&lt;br /&gt;
&lt;br /&gt;
    while(++len) {          &lt;br /&gt;
        string currentField = llList2String(parsedMessage, len); // Current key/value pair as a string.&lt;br /&gt;
&lt;br /&gt;
        integer split = llSubStringIndex(currentField,&amp;quot;=&amp;quot;);     // Find the &amp;quot;=&amp;quot; sign&lt;br /&gt;
        if(split == -1) { // There is only one field in this part of the message.&lt;br /&gt;
            postData += [llUnescapeURL(currentField),&amp;quot;&amp;quot;];  &lt;br /&gt;
        } else {&lt;br /&gt;
            postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    // Return the strided list.&lt;br /&gt;
    return postData ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL(); // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    http_request(key id, string method, string body) {&lt;br /&gt;
         list incomingMessage;&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + &lt;br /&gt;
                       body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information form the outside: &amp;quot; + body);&lt;br /&gt;
            incomingMessage = parsePostData(body);&lt;br /&gt;
            llOwnerSay(llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;You passed the following:\n&amp;quot; + &lt;br /&gt;
                           llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has&lt;br /&gt;
            // not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding PERL script for contacting the LSL script on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my $url = shift;                   # First get the arguments.&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;                # Create the object&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);   # used to send the&lt;br /&gt;
                                                      # HTTP request&lt;br /&gt;
&lt;br /&gt;
    $request-&amp;gt;content_type                            # Set the&lt;br /&gt;
	(&#039;application/x-www-form-urlencoded&#039;);        # encoding type.&lt;br /&gt;
    $request-&amp;gt;content(hash2URI($information));        # Set the content to&lt;br /&gt;
                                                      # send.&lt;br /&gt;
&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);       # Send the request.&lt;br /&gt;
    return($response-&amp;gt;content);                       # Return the&lt;br /&gt;
						      # information that&lt;br /&gt;
						      # was sent back&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #########################################################################&lt;br /&gt;
# Convert a hash to a url encoded string &lt;br /&gt;
#      hash2URI(\%hash)&lt;br /&gt;
sub hash2URI {&lt;br /&gt;
    my $theHash = shift;            # Get the arguments passed.&lt;br /&gt;
    my $encodedString = &#039;&#039;;         # The encoded string to return.&#039;&lt;br /&gt;
    my $lupe;                       # a loop variable.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    foreach $lupe (keys %{$theHash}) {                # &lt;br /&gt;
	$encodedString .= uri_escape($lupe) . &#039;=&#039; .   # Add each item in the&lt;br /&gt;
	    uri_escape($$theHash{$lupe}) . &#039;&amp;amp;&#039;;       # hash to the encoded string.&lt;br /&gt;
    }&lt;br /&gt;
    $encodedString =~ s/&amp;amp;$//;                         # Remove the trailing &amp;quot;&amp;amp;&amp;quot;&lt;br /&gt;
    return($encodedString);                           # Send the encoded string.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,{&#039;action&#039; =&amp;gt; &#039;send message&#039;,&lt;br /&gt;
	   &#039;value&#039;=&amp;gt; &#039;Hi there chief!&#039;,&lt;br /&gt;
	   &#039;id&#039;=&amp;gt;&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
	   &#039;name&#039;=&amp;gt;&#039;M Linden&#039;});&lt;br /&gt;
&lt;br /&gt;
print($info,&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding Python script. It does the same thing as the PERL script above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    &lt;br /&gt;
#    encodedParams =  urllib.urlencode(parameters);  # encode the parameters&lt;br /&gt;
    encodedParams  = dictionary2URI(parameters);    # encode the parameters&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);        # Post the data.&lt;br /&gt;
    return(net.read());                             # return the result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ################################################&lt;br /&gt;
# Routine to encode a dictionary without using &lt;br /&gt;
# &amp;quot;+&amp;quot; for spaces.&lt;br /&gt;
#       dictionary2URI(theDictionary)&lt;br /&gt;
def dictionary2URI(theDictionary) : &lt;br /&gt;
&lt;br /&gt;
    encoded = &#039;&#039;;           # Initialize the string to return&lt;br /&gt;
    for key, value in theDictionary.iteritems():&lt;br /&gt;
        # Encode each item in the dictionary.&lt;br /&gt;
        encoded += urllib.quote(key)+&amp;quot;=&amp;quot;+urllib.quote(value)+&amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    remove = re.compile(&#039;&amp;amp;$&#039;)             # Remove the trailing ampersand.&lt;br /&gt;
    encoded = remove.sub(&#039;&#039;,encoded);&lt;br /&gt;
&lt;br /&gt;
    return(encoded);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;,&lt;br /&gt;
                  &#039;action&#039;:&#039;send message&#039;,&lt;br /&gt;
                  &#039;value&#039;:&#039;Hey there, hi there, ho there!&#039;};&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;lsl&amp;gt;&amp;lt;/lsl&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple script for sending data to an LSL via PHP ===&lt;br /&gt;
This example by Simba Fuhr &#039;&#039;&#039;UPDATE April 16, 2011&#039;&#039;&#039;&lt;br /&gt;
{{Warning|Some hosting providers only allow fsockopen on the standard 80 and 443 ports.  This script will not work on those providers. If your provider is willing to open some ports for you, HTTP-in uses port 12046, and HTTPS-in uses port 12043.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039;&lt;br /&gt;
To use SSL encrypted sockets, you need to have SSL activated on your server. If you run your own server, you need to import the ssl support to your server (apache =&amp;gt; apache.conf  +&amp;quot;LoadModule ssl_module modules/mod_ssl.so&amp;quot;)(normaly based on openssl).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Secure URL Request with LSL.&lt;br /&gt;
Script returns the URL to the chat. Please put the URL into the PHP below.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  llRequestSecureURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key id, string method, string body)&lt;br /&gt;
 {&lt;br /&gt;
  if ((method == URL_REQUEST_GRANTED))&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (method == &amp;quot;POST&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
   llHTTPResponse(id, 200, &amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the PHP.&lt;br /&gt;
A more advanced php function which supports complete url structures and automatical GET and POST types.&lt;br /&gt;
Just don&#039;t submit any post Data to make a GET request.&lt;br /&gt;
The Function supports any kind of url as secure and not secure (https and http).&lt;br /&gt;
If you dont submit a port in the url, the default port for http (80) and https (443) will be used.&lt;br /&gt;
(An example is shown on the top of the script.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo &amp;quot;LSL Script answered:&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
echo Advanced_HTTP_Request(&amp;quot;https://sim20557.agni.lindenlab.com:12043/cap/5851e666-b0c6-f0a0-758a-9e8156765215&amp;quot;, &amp;quot;Hello script, how are you ?&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
function Advanced_HTTP_Request($Host, $PostData = &amp;quot;&amp;quot;)&lt;br /&gt;
{&lt;br /&gt;
 $Method = &amp;quot;POST&amp;quot;;&lt;br /&gt;
 if (empty($PostData))&lt;br /&gt;
  {$Method = &amp;quot;GET&amp;quot;;}&lt;br /&gt;
 $Port = 80;&lt;br /&gt;
 if (strtolower(substr($Host, 0, 5)) == &amp;quot;https&amp;quot;)&lt;br /&gt;
  {$Port = 443;}&lt;br /&gt;
 $Host = explode(&amp;quot;//&amp;quot;, $Host, 2);&lt;br /&gt;
 if (count($Host) &amp;lt; 2)&lt;br /&gt;
  {$Host[1] = $Host[0];}&lt;br /&gt;
 $Host = explode(&amp;quot;/&amp;quot;, $Host[1], 2);&lt;br /&gt;
 if ($Port == 443)&lt;br /&gt;
  {$SSLAdd = &amp;quot;ssl://&amp;quot;;}&lt;br /&gt;
 $Host[0] = explode(&amp;quot;:&amp;quot;, $Host[0]);&lt;br /&gt;
 if (count($Host[0]) &amp;gt; 1)&lt;br /&gt;
 {&lt;br /&gt;
  $Port = $Host[0][1];&lt;br /&gt;
  $Host[0] = $Host[0][0];&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
  {$Host[0] = $Host[0][0];}&lt;br /&gt;
 $Socket = fsockopen($SSLAdd.$Host[0], $Port, $Dummy1, $Dummy2, 10);&lt;br /&gt;
 if ($Socket)&lt;br /&gt;
 {&lt;br /&gt;
  fputs($Socket, &amp;quot;$Method /$Host[1] HTTP/1.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Host: $Host[0]\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-type: application/x-www-form-urlencoded\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-length: &amp;quot;.strlen($PostData).&amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Connection: close\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 $PostData);&lt;br /&gt;
  $Tme = time();&lt;br /&gt;
  while(!feof($Socket) &amp;amp;&amp;amp; $Tme + 30 &amp;gt; time())&lt;br /&gt;
   {$Res = $Res.fgets($Socket, 256);}&lt;br /&gt;
  fclose($Socket);&lt;br /&gt;
 }&lt;br /&gt;
 $Res = explode(&amp;quot;\r\n\r\n&amp;quot;, $Res, 2);&lt;br /&gt;
 return $Res[1];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Kelly&#039;s Stupid Web Status Updater ===&lt;br /&gt;
Is actually on its own page: [[LSL_http_server/examples/kellys_stupid_web_status_updater | Kelly&#039;s Stupid Web Status Updater]]&amp;lt;br&amp;gt;&lt;br /&gt;
Kurai&#039;s mod from Kelly&#039;s stupid thing: [[LSL_http_server/examples/kurais_stupid_web_status_updater| Kurai&#039;s Stupid Web Status Updater Mod]]&lt;br /&gt;
{{LSLC|HTTP}}{{LSLC|Examples}}&lt;br /&gt;
&lt;br /&gt;
=== Web-based dynamic buildings ===&lt;br /&gt;
HTTP-in may be used to easily send commands from a web page to an in-world object, so that web users can control and interact with buildings. The interactive installation &#039;&#039;Chromutate&#039;&#039; is based upon this idea: see its [[User:Opensource_Obscure/Chromutate|documentation page]] for free scripts and more details.&lt;br /&gt;
&lt;br /&gt;
=== PHP/SQL Object DNS ===&lt;br /&gt;
Simple DNS server written in PHP to facilitate a DNS service for LSL scripts&lt;br /&gt;
[[LSL_http_server/examples/phpdns|PHPDNS]]&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1143891</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1143891"/>
		<updated>2011-05-17T08:16:11Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://n2k.danardlabs.com (SSL, {{LSLGC|Legacy Name|Legacy Names}} &amp;amp; {{LSLGC|Username|Usernames}} supported)&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://kubwa.net/index.php?cmd=name2key (Bot based name2key Database. Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats)&lt;br /&gt;
*http://www.db4mv.info (Name2Key Database for Avatars ({{LSLGC|Legacy Name|Legacy Names}},{{LSLGC|Username|Usernames}}, and {{LSLGC|Display Name|Display Names}}, GroupNames and Keys, LSL API)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&amp;lt;/s&amp;gt; &amp;lt;font color=red&amp;gt;(Apez seems to be gone ? - May 2011)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1143890</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1143890"/>
		<updated>2011-05-17T08:15:42Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://n2k.danardlabs.com (SSL, {{LSLGC|Legacy Name|Legacy Names}} &amp;amp; {{LSLGC|Username|Usernames}} supported)&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://kubwa.net/index.php?cmd=name2key (Bot based name2key Database. Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats)&lt;br /&gt;
*http://www.db4mv.info (Name2Key Database for Avatars ({{LSLGC|Legacy Name|Legacy Names}},{{LSLGC|Username|Usernames}}, and {{LSLGC|Display Name|Display Names}}, GroupNames and Keys, LSL API)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&amp;lt;/s&amp;gt; (Apez seems to be gone ? - May 2011)&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1142051</id>
		<title>LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1142051"/>
		<updated>2011-05-02T04:10:11Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: /* Simple script for sending data to an LSL via PHP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}&lt;br /&gt;
=== Utility Script ===&lt;br /&gt;
A script intended as a &#039;fill in the blank&#039; exercise for very, very simple HTTP servers is here: [[LSL_http_server/examples/utility_script | Utility Script]]&lt;br /&gt;
=== Hello World! ===&lt;br /&gt;
Classic example, the smallest http_request script possible.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
A slightly more robust version:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Echo World ===&lt;br /&gt;
&amp;quot;Echo World ([[User:Byrd Sciavo|Byrd Sciavo]] 04:19, 7 October 2009 (UTC))&amp;quot; is a slightly more useful &amp;quot;Hello World&amp;quot;, demonstrating a basic server that echos back dynamic data fed. Echo World shows how http_request receives GET variables. To receive this &amp;quot;dynamic echo&amp;quot;, append your cap url with a query string, such as https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry(){&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body){    &lt;br /&gt;
        if (method == URL_REQUEST_GRANTED) {&lt;br /&gt;
            url=body;llOwnerSay(url);&lt;br /&gt;
        }else if(method==&amp;quot;GET&amp;quot;){&lt;br /&gt;
              if(llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;)==&amp;quot;&amp;quot;) llHTTPResponse(id,200,&amp;quot;I ECHO when you append some GET variables to me, e.g., /?var=foo&amp;quot;);&lt;br /&gt;
              else llHTTPResponse(id,200,llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;));&lt;br /&gt;
        }        &lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visitor List ===&lt;br /&gt;
A list of residents within sensor range of the server.&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
* This includes a method for handling multiple requests while waiting for asynchronous data requests to come back.&lt;br /&gt;
&amp;lt;lsl&amp;gt;integer scanning = FALSE;&lt;br /&gt;
&lt;br /&gt;
list requests;&lt;br /&gt;
&lt;br /&gt;
send_response(string body)&lt;br /&gt;
{&lt;br /&gt;
    integer j;&lt;br /&gt;
    for (j = 0; j &amp;lt; llGetListLength(requests); ++j)&lt;br /&gt;
    {&lt;br /&gt;
        llHTTPResponse(llList2Key(requests,j), 200, body);&lt;br /&gt;
    }&lt;br /&gt;
    requests = [];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            if (!scanning)&lt;br /&gt;
            {&lt;br /&gt;
                llSensor(&amp;quot;&amp;quot;,NULL_KEY,AGENT,96,PI);&lt;br /&gt;
                scanning = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            requests += [id];&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported method.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    no_sensor()&lt;br /&gt;
    {&lt;br /&gt;
        send_response(&amp;quot;There is no one here.&amp;quot;);&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    sensor(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        string output;&lt;br /&gt;
        if (n &amp;lt; 16) output = &amp;quot;There are &amp;quot; + (string)n + &amp;quot; avatars nearby:&amp;quot;;&lt;br /&gt;
        else output = &amp;quot;There are at least 16 avatars nearby:&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i = 0;i&amp;lt;n;++i)&lt;br /&gt;
        {&lt;br /&gt;
            output += &amp;quot;\n\t&amp;quot; + llDetectedName(i);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        send_response(output);&lt;br /&gt;
&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Url Persistence / Visitor Counter ===&lt;br /&gt;
A more complete &#039;hello world&#039;, always has an url and keeps a visitor counter.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
integer hits;&lt;br /&gt;
&lt;br /&gt;
setup()&lt;br /&gt;
{&lt;br /&gt;
    llSetObjectName(&amp;quot;HTTP Server&amp;quot;);&lt;br /&gt;
    url = &amp;quot;&amp;quot;;&lt;br /&gt;
    llRequestURL();&lt;br /&gt;
    hits = (integer)llGetObjectDesc();&lt;br /&gt;
    llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { setup(); }&lt;br /&gt;
    on_rez(integer n) { setup(); }&lt;br /&gt;
    &lt;br /&gt;
    changed(integer c)&lt;br /&gt;
    {&lt;br /&gt;
        if (c &amp;amp; (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )&lt;br /&gt;
        {&lt;br /&gt;
            setup();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    touch_start(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;My url is: &amp;quot; + url);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            url = body;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            ++hits;&lt;br /&gt;
            llSetObjectDesc((string)hits);&lt;br /&gt;
            llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello!  You are visitor &amp;quot; + (string)hits + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Method unsupported&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid.  ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL();     // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
     http_request(key id, string method, string body) {&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information from the outside: &amp;quot; + body);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Thank you for calling. All of our operators are busy.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the PERL script to contact the prim on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
    # First get the arguments.&lt;br /&gt;
    my $url = shift;&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    # Create the objects to be used to send out the HTTP request&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);&lt;br /&gt;
&lt;br /&gt;
    # Set the encoding method and specify the information to be sent.&lt;br /&gt;
    $request-&amp;gt;content_type(&#039;application/x-www-form-urlencoded&#039;);&lt;br /&gt;
    $request-&amp;gt;content(uri_escape($information));&lt;br /&gt;
&lt;br /&gt;
    # Send the request.&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);&lt;br /&gt;
&lt;br /&gt;
    # Return the information sent back&lt;br /&gt;
    return($response-&amp;gt;content);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,&#039;id=244195d6-c9b7-4fd6-9229-c3a8b2e60e81&amp;amp;name=M Linden&#039;);&lt;br /&gt;
&lt;br /&gt;
print $info,&amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the Python code that does the same thing as the PERL code above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    # Set the parameters to be sent.&lt;br /&gt;
    encodedParams =  urllib.urlencode(parameters);&lt;br /&gt;
&lt;br /&gt;
    # Post the data.&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);&lt;br /&gt;
&lt;br /&gt;
    # return the result.&lt;br /&gt;
    return(net.read());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;}&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST With Argument Parsing ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. In this example the scripts are adapted to handle the parsing of the arguments that are passed. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid. ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
// ###############################################&lt;br /&gt;
// Routine to parse a string sent through the &lt;br /&gt;
// http server via post.&lt;br /&gt;
//       parsePostData(theMessage)&lt;br /&gt;
// Returns a strided list with stride length 2.&lt;br /&gt;
// Each set has the key and then its value.&lt;br /&gt;
list parsePostData(string message) {&lt;br /&gt;
    list postData = [];         // The list with the data that was passed in.&lt;br /&gt;
    list parsedMessage = llParseString2List(message,[&amp;quot;&amp;amp;&amp;quot;],[]);    // The key/value pairs parsed into one list.&lt;br /&gt;
    integer len = ~llGetListLength(parsedMessage);&lt;br /&gt;
&lt;br /&gt;
    while(++len) {          &lt;br /&gt;
        string currentField = llList2String(parsedMessage, len); // Current key/value pair as a string.&lt;br /&gt;
&lt;br /&gt;
        integer split = llSubStringIndex(currentField,&amp;quot;=&amp;quot;);     // Find the &amp;quot;=&amp;quot; sign&lt;br /&gt;
        if(split == -1) { // There is only one field in this part of the message.&lt;br /&gt;
            postData += [llUnescapeURL(currentField),&amp;quot;&amp;quot;];  &lt;br /&gt;
        } else {&lt;br /&gt;
            postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    // Return the strided list.&lt;br /&gt;
    return postData ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL(); // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    http_request(key id, string method, string body) {&lt;br /&gt;
         list incomingMessage;&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + &lt;br /&gt;
                       body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information form the outside: &amp;quot; + body);&lt;br /&gt;
            incomingMessage = parsePostData(body);&lt;br /&gt;
            llOwnerSay(llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;You passed the following:\n&amp;quot; + &lt;br /&gt;
                           llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has&lt;br /&gt;
            // not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding PERL script for contacting the LSL script on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my $url = shift;                   # First get the arguments.&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;                # Create the object&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);   # used to send the&lt;br /&gt;
                                                      # HTTP request&lt;br /&gt;
&lt;br /&gt;
    $request-&amp;gt;content_type                            # Set the&lt;br /&gt;
	(&#039;application/x-www-form-urlencoded&#039;);        # encoding type.&lt;br /&gt;
    $request-&amp;gt;content(hash2URI($information));        # Set the content to&lt;br /&gt;
                                                      # send.&lt;br /&gt;
&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);       # Send the request.&lt;br /&gt;
    return($response-&amp;gt;content);                       # Return the&lt;br /&gt;
						      # information that&lt;br /&gt;
						      # was sent back&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #########################################################################&lt;br /&gt;
# Convert a hash to a url encoded string &lt;br /&gt;
#      hash2URI(\%hash)&lt;br /&gt;
sub hash2URI {&lt;br /&gt;
    my $theHash = shift;            # Get the arguments passed.&lt;br /&gt;
    my $encodedString = &#039;&#039;;         # The encoded string to return.&lt;br /&gt;
    my $lupe;                       # a loop variable.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    foreach $lupe (keys %{$theHash}) {                # &lt;br /&gt;
	$encodedString .= uri_escape($lupe) . &#039;=&#039; .   # Add each item in the&lt;br /&gt;
	    uri_escape($$theHash{$lupe}) . &#039;&amp;amp;&#039;;       # hash to the encoded string.&lt;br /&gt;
    }&lt;br /&gt;
    $encodedString =~ s/&amp;amp;$//;                         # Remove the trailing &amp;quot;&amp;amp;&amp;quot;&lt;br /&gt;
    return($encodedString);                           # Send the encoded string.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,{&#039;action&#039; =&amp;gt; &#039;send message&#039;,&lt;br /&gt;
	   &#039;value&#039;=&amp;gt; &#039;Hi there chief!&#039;,&lt;br /&gt;
	   &#039;id&#039;=&amp;gt;&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
	   &#039;name&#039;=&amp;gt;&#039;M Linden&#039;});&lt;br /&gt;
&lt;br /&gt;
print($info,&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding Python script. It does the same thing as the PERL script above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    &lt;br /&gt;
#    encodedParams =  urllib.urlencode(parameters);  # encode the parameters&lt;br /&gt;
    encodedParams  = dictionary2URI(parameters);    # encode the parameters&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);        # Post the data.&lt;br /&gt;
    return(net.read());                             # return the result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ################################################&lt;br /&gt;
# Routine to encode a dictionary without using &lt;br /&gt;
# &amp;quot;+&amp;quot; for spaces.&lt;br /&gt;
#       dictionary2URI(theDictionary)&lt;br /&gt;
def dictionary2URI(theDictionary) : &lt;br /&gt;
&lt;br /&gt;
    encoded = &#039;&#039;;           # Initialize the string to return&lt;br /&gt;
    for key, value in theDictionary.iteritems():&lt;br /&gt;
        # Encode each item in the dictionary.&lt;br /&gt;
        encoded += urllib.quote(key)+&amp;quot;=&amp;quot;+urllib.quote(value)+&amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    remove = re.compile(&#039;&amp;amp;$&#039;)             # Remove the trailing ampersand.&lt;br /&gt;
    encoded = remove.sub(&#039;&#039;,encoded);&lt;br /&gt;
&lt;br /&gt;
    return(encoded);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;,&lt;br /&gt;
                  &#039;action&#039;:&#039;send message&#039;,&lt;br /&gt;
                  &#039;value&#039;:&#039;Hey there, hi there, ho there!&#039;};&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;lsl&amp;gt;&amp;lt;/lsl&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple script for sending data to an LSL via PHP ===&lt;br /&gt;
This example by Simba Fuhr &#039;&#039;&#039;UPDATE April 16, 2011&#039;&#039;&#039;&lt;br /&gt;
{{Warning|Some hosting providers only allow fsockopen on the standard 80 and 443 ports.  This script will not work on those providers. If your provider is willing to open some ports for you, HTTP-in uses port 12046, and HTTPS-in uses port 12043.}}&lt;br /&gt;
&lt;br /&gt;
Secure URL Request with LSL.&lt;br /&gt;
Script returns the URL to the chat. Please put the URL into the PHP below.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  llRequestSecureURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key id, string method, string body)&lt;br /&gt;
 {&lt;br /&gt;
  if ((method == URL_REQUEST_GRANTED))&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (method == &amp;quot;POST&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
   llHTTPResponse(id, 200, &amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the PHP.&lt;br /&gt;
A more advanced php function which supports complete url structures and automatical GET and POST types.&lt;br /&gt;
Just don&#039;t submit any post Data to make a GET request.&lt;br /&gt;
The Function supports any kind of url as secure and not secure (https and http).&lt;br /&gt;
If you dont submit a port in the url, the default port for http (80) and https (443) will be used.&lt;br /&gt;
(An example is shown on the top of the script.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo &amp;quot;LSL Script answered:&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
echo Advanced_HTTP_Request(&amp;quot;https://sim20557.agni.lindenlab.com:12043/cap/5851e666-b0c6-f0a0-758a-9e8156765215&amp;quot;, &amp;quot;Hello script, how are you ?&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
function Advanced_HTTP_Request($Host, $PostData = &amp;quot;&amp;quot;)&lt;br /&gt;
{&lt;br /&gt;
 $Method = &amp;quot;POST&amp;quot;;&lt;br /&gt;
 if (empty($PostData))&lt;br /&gt;
  {$Method = &amp;quot;GET&amp;quot;;}&lt;br /&gt;
 $Port = 80;&lt;br /&gt;
 if (strtolower(substr($Host, 0, 5)) == &amp;quot;https&amp;quot;)&lt;br /&gt;
  {$Port = 443;}&lt;br /&gt;
 $Host = explode(&amp;quot;//&amp;quot;, $Host, 2);&lt;br /&gt;
 if (count($Host) &amp;lt; 2)&lt;br /&gt;
  {$Host[1] = $Host[0];}&lt;br /&gt;
 $Host = explode(&amp;quot;/&amp;quot;, $Host[1], 2);&lt;br /&gt;
 if ($Port == 443)&lt;br /&gt;
  {$SSLAdd = &amp;quot;ssl://&amp;quot;;}&lt;br /&gt;
 $Host[0] = explode(&amp;quot;:&amp;quot;, $Host[0]);&lt;br /&gt;
 if (count($Host[0]) &amp;gt; 1)&lt;br /&gt;
 {&lt;br /&gt;
  $Port = $Host[0][1];&lt;br /&gt;
  $Host[0] = $Host[0][0];&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
  {$Host[0] = $Host[0][0];}&lt;br /&gt;
 $Socket = fsockopen($SSLAdd.$Host[0], $Port, $Dummy1, $Dummy2, 10);&lt;br /&gt;
 if ($Socket)&lt;br /&gt;
 {&lt;br /&gt;
  fputs($Socket, &amp;quot;$Method /$Host[1] HTTP/1.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Host: $Host[0]\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-type: application/x-www-form-urlencoded\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-length: &amp;quot;.strlen($PostData).&amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Connection: close\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 $PostData);&lt;br /&gt;
  $Tme = time();&lt;br /&gt;
  while(!feof($Socket) &amp;amp;&amp;amp; $Tme + 30 &amp;gt; time())&lt;br /&gt;
   {$Res = $Res.fgets($Socket, 256);}&lt;br /&gt;
  fclose($Socket);&lt;br /&gt;
 }&lt;br /&gt;
 $Res = explode(&amp;quot;\r\n\r\n&amp;quot;, $Res, 2);&lt;br /&gt;
 return $Res[1];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Kelly&#039;s Stupid Web Status Updater ===&lt;br /&gt;
Is actually on its own page: [[LSL_http_server/examples/kellys_stupid_web_status_updater | Kelly&#039;s Stupid Web Status Updater]]&amp;lt;br&amp;gt;&lt;br /&gt;
Kurai&#039;s mod from Kelly&#039;s stupid thing: [[LSL_http_server/examples/kurais_stupid_web_status_updater| Kurai&#039;s Stupid Web Status Updater Mod]]&lt;br /&gt;
{{LSLC|HTTP}}{{LSLC|Examples}}&lt;br /&gt;
&lt;br /&gt;
=== Grid URL Persister sample script ===&lt;br /&gt;
[[User:Opensource_Obscure/http/gridurl-sample|This script]] shows how to use the free &#039;&#039;[http://gridurl.appspot.com Grid URL Persister]&#039;&#039; web service in order to deal with LSL HTTP Server temporary URLs.&lt;br /&gt;
&lt;br /&gt;
=== Web-based dynamic buildings ===&lt;br /&gt;
HTTP-in may be used to easily send commands from a web page to an in-world object, so that web users can control and interact with buildings. The interactive installation &#039;&#039;Chromutate&#039;&#039; is based upon this idea: see its [[User:Opensource_Obscure/Chromutate|documentation page]] for free scripts and more details.&lt;br /&gt;
&lt;br /&gt;
=== PHP/SQL Object DNS ===&lt;br /&gt;
Simple DNS server written in PHP to facilitate a DNS service for LSL scripts&lt;br /&gt;
[[LSL_http_server/examples/phpdns|PHPDNS]]&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Talk:LSL_HTTP_server/examples&amp;diff=1142050</id>
		<title>Talk:LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Talk:LSL_HTTP_server/examples&amp;diff=1142050"/>
		<updated>2011-05-02T04:07:16Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have ideas for examples that would be useful, please put them here and I will see what I can do.  Thanks! - [[User:Kelly Linden|Kelly Linden]] 11:39, 21 July 2008 (PDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I just added two sets of examples for using the POST method from an outside server. Examples using PERL and Python are provided. Hopefully they make sense. [[User:Grandma Bates|Grandma Bates]] 12:40, 27 May 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
:They look good. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 17:46, 27 May 2009 (UTC)&lt;br /&gt;
:: Thanks Grandma Bates! And for the bit of cleanup Strife.&lt;br /&gt;
&lt;br /&gt;
Changed the old php socket example to a newer, more flexible one.&lt;br /&gt;
If there are any questions or problems ping me in Second Life.&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1140971</id>
		<title>LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1140971"/>
		<updated>2011-04-16T11:21:47Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: /* Simple script for sending data to an LSL via PHP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}&lt;br /&gt;
=== Utility Script ===&lt;br /&gt;
A script intended as a &#039;fill in the blank&#039; exercise for very, very simple HTTP servers is here: [[LSL_http_server/examples/utility_script | Utility Script]]&lt;br /&gt;
=== Hello World! ===&lt;br /&gt;
Classic example, the smallest http_request script possible.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
A slightly more robust version:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Echo World ===&lt;br /&gt;
&amp;quot;Echo World ([[User:Byrd Sciavo|Byrd Sciavo]] 04:19, 7 October 2009 (UTC))&amp;quot; is a slightly more useful &amp;quot;Hello World&amp;quot;, demonstrating a basic server that echos back dynamic data fed. Echo World shows how http_request receives GET variables. To receive this &amp;quot;dynamic echo&amp;quot;, append your cap url with a query string, such as https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry(){&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body){    &lt;br /&gt;
        if (method == URL_REQUEST_GRANTED) {&lt;br /&gt;
            url=body;llOwnerSay(url);&lt;br /&gt;
        }else if(method==&amp;quot;GET&amp;quot;){&lt;br /&gt;
              if(llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;)==&amp;quot;&amp;quot;) llHTTPResponse(id,200,&amp;quot;I ECHO when you append some GET variables to me, e.g., /?var=foo&amp;quot;);&lt;br /&gt;
              else llHTTPResponse(id,200,llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;));&lt;br /&gt;
        }        &lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visitor List ===&lt;br /&gt;
A list of residents within sensor range of the server.&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
* This includes a method for handling multiple requests while waiting for asynchronous data requests to come back.&lt;br /&gt;
&amp;lt;lsl&amp;gt;integer scanning = FALSE;&lt;br /&gt;
&lt;br /&gt;
list requests;&lt;br /&gt;
&lt;br /&gt;
send_response(string body)&lt;br /&gt;
{&lt;br /&gt;
    integer j;&lt;br /&gt;
    for (j = 0; j &amp;lt; llGetListLength(requests); ++j)&lt;br /&gt;
    {&lt;br /&gt;
        llHTTPResponse(llList2Key(requests,j), 200, body);&lt;br /&gt;
    }&lt;br /&gt;
    requests = [];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            if (!scanning)&lt;br /&gt;
            {&lt;br /&gt;
                llSensor(&amp;quot;&amp;quot;,NULL_KEY,AGENT,96,PI);&lt;br /&gt;
                scanning = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            requests += [id];&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported method.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    no_sensor()&lt;br /&gt;
    {&lt;br /&gt;
        send_response(&amp;quot;There is no one here.&amp;quot;);&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    sensor(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        string output;&lt;br /&gt;
        if (n &amp;lt; 16) output = &amp;quot;There are &amp;quot; + (string)n + &amp;quot; avatars nearby:&amp;quot;;&lt;br /&gt;
        else output = &amp;quot;There are at least 16 avatars nearby:&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i = 0;i&amp;lt;n;++i)&lt;br /&gt;
        {&lt;br /&gt;
            output += &amp;quot;\n\t&amp;quot; + llDetectedName(i);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        send_response(output);&lt;br /&gt;
&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Url Persistence / Visitor Counter ===&lt;br /&gt;
A more complete &#039;hello world&#039;, always has an url and keeps a visitor counter.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
integer hits;&lt;br /&gt;
&lt;br /&gt;
setup()&lt;br /&gt;
{&lt;br /&gt;
    llSetObjectName(&amp;quot;HTTP Server&amp;quot;);&lt;br /&gt;
    url = &amp;quot;&amp;quot;;&lt;br /&gt;
    llRequestURL();&lt;br /&gt;
    hits = (integer)llGetObjectDesc();&lt;br /&gt;
    llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { setup(); }&lt;br /&gt;
    on_rez(integer n) { setup(); }&lt;br /&gt;
    &lt;br /&gt;
    changed(integer c)&lt;br /&gt;
    {&lt;br /&gt;
        if (c &amp;amp; (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )&lt;br /&gt;
        {&lt;br /&gt;
            setup();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    touch_start(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;My url is: &amp;quot; + url);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            url = body;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            ++hits;&lt;br /&gt;
            llSetObjectDesc((string)hits);&lt;br /&gt;
            llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello!  You are visitor &amp;quot; + (string)hits + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Method unsupported&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid.  ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL();     // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
     http_request(key id, string method, string body) {&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information from the outside: &amp;quot; + body);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Thank you for calling. All of our operators are busy.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the PERL script to contact the prim on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
    # First get the arguments.&lt;br /&gt;
    my $url = shift;&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    # Create the objects to be used to send out the HTTP request&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);&lt;br /&gt;
&lt;br /&gt;
    # Set the encoding method and specify the information to be sent.&lt;br /&gt;
    $request-&amp;gt;content_type(&#039;application/x-www-form-urlencoded&#039;);&lt;br /&gt;
    $request-&amp;gt;content(uri_escape($information));&lt;br /&gt;
&lt;br /&gt;
    # Send the request.&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);&lt;br /&gt;
&lt;br /&gt;
    # Return the information sent back&lt;br /&gt;
    return($response-&amp;gt;content);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,&#039;id=244195d6-c9b7-4fd6-9229-c3a8b2e60e81&amp;amp;name=M Linden&#039;);&lt;br /&gt;
&lt;br /&gt;
print $info,&amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the Python code that does the same thing as the PERL code above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    # Set the parameters to be sent.&lt;br /&gt;
    encodedParams =  urllib.urlencode(parameters);&lt;br /&gt;
&lt;br /&gt;
    # Post the data.&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);&lt;br /&gt;
&lt;br /&gt;
    # return the result.&lt;br /&gt;
    return(net.read());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;}&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST With Argument Parsing ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. In this example the scripts are adapted to handle the parsing of the arguments that are passed. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid. ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
// ###############################################&lt;br /&gt;
// Routine to parse a string sent through the &lt;br /&gt;
// http server via post.&lt;br /&gt;
//       parsePostData(theMessage)&lt;br /&gt;
// Returns a strided list with stride length 2.&lt;br /&gt;
// Each set has the key and then its value.&lt;br /&gt;
list parsePostData(string message) {&lt;br /&gt;
    list postData = [];         // The list with the data that was passed in.&lt;br /&gt;
    list parsedMessage = llParseString2List(message,[&amp;quot;&amp;amp;&amp;quot;],[]);    // The key/value pairs parsed into one list.&lt;br /&gt;
    integer len = ~llGetListLength(parsedMessage);&lt;br /&gt;
&lt;br /&gt;
    while(++len) {          &lt;br /&gt;
        string currentField = llList2String(parsedMessage, len); // Current key/value pair as a string.&lt;br /&gt;
&lt;br /&gt;
        integer split = llSubStringIndex(currentField,&amp;quot;=&amp;quot;);     // Find the &amp;quot;=&amp;quot; sign&lt;br /&gt;
        if(split == -1) { // There is only one field in this part of the message.&lt;br /&gt;
            postData += [llUnescapeURL(currentField),&amp;quot;&amp;quot;];  &lt;br /&gt;
        } else {&lt;br /&gt;
            postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    // Return the strided list.&lt;br /&gt;
    return postData ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL(); // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    http_request(key id, string method, string body) {&lt;br /&gt;
         list incomingMessage;&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + &lt;br /&gt;
                       body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information form the outside: &amp;quot; + body);&lt;br /&gt;
            incomingMessage = parsePostData(body);&lt;br /&gt;
            llOwnerSay(llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;You passed the following:\n&amp;quot; + &lt;br /&gt;
                           llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has&lt;br /&gt;
            // not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding PERL script for contacting the LSL script on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my $url = shift;                   # First get the arguments.&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;                # Create the object&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);   # used to send the&lt;br /&gt;
                                                      # HTTP request&lt;br /&gt;
&lt;br /&gt;
    $request-&amp;gt;content_type                            # Set the&lt;br /&gt;
	(&#039;application/x-www-form-urlencoded&#039;);        # encoding type.&lt;br /&gt;
    $request-&amp;gt;content(hash2URI($information));        # Set the content to&lt;br /&gt;
                                                      # send.&lt;br /&gt;
&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);       # Send the request.&lt;br /&gt;
    return($response-&amp;gt;content);                       # Return the&lt;br /&gt;
						      # information that&lt;br /&gt;
						      # was sent back&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #########################################################################&lt;br /&gt;
# Convert a hash to a url encoded string &lt;br /&gt;
#      hash2URI(\%hash)&lt;br /&gt;
sub hash2URI {&lt;br /&gt;
    my $theHash = shift;            # Get the arguments passed.&lt;br /&gt;
    my $encodedString = &#039;&#039;;         # The encoded string to return.&lt;br /&gt;
    my $lupe;                       # a loop variable.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    foreach $lupe (keys %{$theHash}) {                # &lt;br /&gt;
	$encodedString .= uri_escape($lupe) . &#039;=&#039; .   # Add each item in the&lt;br /&gt;
	    uri_escape($$theHash{$lupe}) . &#039;&amp;amp;&#039;;       # hash to the encoded string.&lt;br /&gt;
    }&lt;br /&gt;
    $encodedString =~ s/&amp;amp;$//;                         # Remove the trailing &amp;quot;&amp;amp;&amp;quot;&lt;br /&gt;
    return($encodedString);                           # Send the encoded string.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,{&#039;action&#039; =&amp;gt; &#039;send message&#039;,&lt;br /&gt;
	   &#039;value&#039;=&amp;gt; &#039;Hi there chief!&#039;,&lt;br /&gt;
	   &#039;id&#039;=&amp;gt;&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
	   &#039;name&#039;=&amp;gt;&#039;M Linden&#039;});&lt;br /&gt;
&lt;br /&gt;
print($info,&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding Python script. It does the same thing as the PERL script above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    &lt;br /&gt;
#    encodedParams =  urllib.urlencode(parameters);  # encode the parameters&lt;br /&gt;
    encodedParams  = dictionary2URI(parameters);    # encode the parameters&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);        # Post the data.&lt;br /&gt;
    return(net.read());                             # return the result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ################################################&lt;br /&gt;
# Routine to encode a dictionary without using &lt;br /&gt;
# &amp;quot;+&amp;quot; for spaces.&lt;br /&gt;
#       dictionary2URI(theDictionary)&lt;br /&gt;
def dictionary2URI(theDictionary) : &lt;br /&gt;
&lt;br /&gt;
    encoded = &#039;&#039;;           # Initialize the string to return&lt;br /&gt;
    for key, value in theDictionary.iteritems():&lt;br /&gt;
        # Encode each item in the dictionary.&lt;br /&gt;
        encoded += urllib.quote(key)+&amp;quot;=&amp;quot;+urllib.quote(value)+&amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    remove = re.compile(&#039;&amp;amp;$&#039;)             # Remove the trailing ampersand.&lt;br /&gt;
    encoded = remove.sub(&#039;&#039;,encoded);&lt;br /&gt;
&lt;br /&gt;
    return(encoded);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;,&lt;br /&gt;
                  &#039;action&#039;:&#039;send message&#039;,&lt;br /&gt;
                  &#039;value&#039;:&#039;Hey there, hi there, ho there!&#039;};&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;lsl&amp;gt;&amp;lt;/lsl&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple script for sending data to an LSL via PHP ===&lt;br /&gt;
This example by Simba Fuhr &#039;&#039;&#039;UPDATE April 16, 2011&#039;&#039;&#039;&lt;br /&gt;
{{Warning|Some hosting providers only allow fsockopen on the standard 80 and 443 ports.  This script will not work on those providers. If your provider is willing to open some ports for you, HTTP-in uses port 12046, and HTTPS-in uses port 12043.}}&lt;br /&gt;
&lt;br /&gt;
Secure URL Request with LSL.&lt;br /&gt;
Script returns the URL to itself. Please put this URL into your request from the PHP.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  llRequestSecureURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key id, string method, string body)&lt;br /&gt;
 {&lt;br /&gt;
  if ((method == URL_REQUEST_GRANTED))&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (method == &amp;quot;POST&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
   llHTTPResponse(id, 200, &amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the PHP.&lt;br /&gt;
A more advanced php function which supports complete url structures and automatical GET and POST types.&lt;br /&gt;
Just dont submit any post Data to make a GET request.&lt;br /&gt;
The Function supports any kind of url as secure and not secure (https and http).&lt;br /&gt;
If you dont submit a port in the url, the default port for http (80) and https (443) will be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo &amp;quot;LSL Script answered:&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
echo Advanced_HTTP_Request(&amp;quot;https://sim20557.agni.lindenlab.com:12043/cap/5851e666-b0c6-f0a0-758a-9e8156765215&amp;quot;, &amp;quot;Hello script, how are you ?&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
function Advanced_HTTP_Request($Host, $PostData = &amp;quot;&amp;quot;)&lt;br /&gt;
{&lt;br /&gt;
 $Method = &amp;quot;POST&amp;quot;;&lt;br /&gt;
 if (empty($PostData))&lt;br /&gt;
  {$Method = &amp;quot;GET&amp;quot;;}&lt;br /&gt;
 $Port = 80;&lt;br /&gt;
 if (strtolower(substr($Host, 0, 5)) == &amp;quot;https&amp;quot;)&lt;br /&gt;
  {$Port = 443;}&lt;br /&gt;
 $Host = explode(&amp;quot;//&amp;quot;, $Host, 2);&lt;br /&gt;
 if (count($Host) &amp;lt; 2)&lt;br /&gt;
  {$Host[1] = $Host[0];}&lt;br /&gt;
 $Host = explode(&amp;quot;/&amp;quot;, $Host[1], 2);&lt;br /&gt;
 if ($Port == 443)&lt;br /&gt;
  {$SSLAdd = &amp;quot;ssl://&amp;quot;;}&lt;br /&gt;
 $Host[0] = explode(&amp;quot;:&amp;quot;, $Host[0]);&lt;br /&gt;
 if (count($Host[0]) &amp;gt; 1)&lt;br /&gt;
 {&lt;br /&gt;
  $Port = $Host[0][1];&lt;br /&gt;
  $Host[0] = $Host[0][0];&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
  {$Host[0] = $Host[0][0];}&lt;br /&gt;
 $Socket = fsockopen($SSLAdd.$Host[0], $Port, $Dummy1, $Dummy2, 10);&lt;br /&gt;
 if ($Socket)&lt;br /&gt;
 {&lt;br /&gt;
  fputs($Socket, &amp;quot;$Method /$Host[1] HTTP/1.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Host: $Host[0]\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-type: application/x-www-form-urlencoded\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-length: &amp;quot;.strlen($PostData).&amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Connection: close\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 $PostData);&lt;br /&gt;
  $Tme = time();&lt;br /&gt;
  while(!feof($Socket) &amp;amp;&amp;amp; $Tme + 30 &amp;gt; time())&lt;br /&gt;
   {$Res = $Res.fgets($Socket, 256);}&lt;br /&gt;
  fclose($Socket);&lt;br /&gt;
 }&lt;br /&gt;
 $Res = explode(&amp;quot;\r\n\r\n&amp;quot;, $Res, 2);&lt;br /&gt;
 return $Res[1];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Kelly&#039;s Stupid Web Status Updater ===&lt;br /&gt;
Is actually on its own page: [[LSL_http_server/examples/kellys_stupid_web_status_updater | Kelly&#039;s Stupid Web Status Updater]]&amp;lt;br&amp;gt;&lt;br /&gt;
Kurai&#039;s mod from Kelly&#039;s stupid thing: [[LSL_http_server/examples/kurais_stupid_web_status_updater| Kurai&#039;s Stupid Web Status Updater Mod]]&lt;br /&gt;
{{LSLC|HTTP}}{{LSLC|Examples}}&lt;br /&gt;
&lt;br /&gt;
=== Grid URL Persister sample script ===&lt;br /&gt;
[[User:Opensource_Obscure/http/gridurl-sample|This script]] shows how to use the free &#039;&#039;[http://gridurl.appspot.com Grid URL Persister]&#039;&#039; web service in order to deal with LSL HTTP Server temporary URLs.&lt;br /&gt;
&lt;br /&gt;
=== Web-based dynamic buildings ===&lt;br /&gt;
HTTP-in may be used to easily send commands from a web page to an in-world object, so that web users can control and interact with buildings. The interactive installation &#039;&#039;Chromutate&#039;&#039; is based upon this idea: see its [[User:Opensource_Obscure/Chromutate|documentation page]] for free scripts and more details.&lt;br /&gt;
&lt;br /&gt;
=== PHP/SQL Object DNS ===&lt;br /&gt;
Simple DNS server written in PHP to facilitate a DNS service for LSL scripts&lt;br /&gt;
[[LSL_http_server/examples/phpdns|PHPDNS]]&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1140970</id>
		<title>LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1140970"/>
		<updated>2011-04-16T11:18:58Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: /* Simple script for sending data to an LSL via PHP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}&lt;br /&gt;
=== Utility Script ===&lt;br /&gt;
A script intended as a &#039;fill in the blank&#039; exercise for very, very simple HTTP servers is here: [[LSL_http_server/examples/utility_script | Utility Script]]&lt;br /&gt;
=== Hello World! ===&lt;br /&gt;
Classic example, the smallest http_request script possible.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
A slightly more robust version:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Echo World ===&lt;br /&gt;
&amp;quot;Echo World ([[User:Byrd Sciavo|Byrd Sciavo]] 04:19, 7 October 2009 (UTC))&amp;quot; is a slightly more useful &amp;quot;Hello World&amp;quot;, demonstrating a basic server that echos back dynamic data fed. Echo World shows how http_request receives GET variables. To receive this &amp;quot;dynamic echo&amp;quot;, append your cap url with a query string, such as https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry(){&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body){    &lt;br /&gt;
        if (method == URL_REQUEST_GRANTED) {&lt;br /&gt;
            url=body;llOwnerSay(url);&lt;br /&gt;
        }else if(method==&amp;quot;GET&amp;quot;){&lt;br /&gt;
              if(llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;)==&amp;quot;&amp;quot;) llHTTPResponse(id,200,&amp;quot;I ECHO when you append some GET variables to me, e.g., /?var=foo&amp;quot;);&lt;br /&gt;
              else llHTTPResponse(id,200,llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;));&lt;br /&gt;
        }        &lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visitor List ===&lt;br /&gt;
A list of residents within sensor range of the server.&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
* This includes a method for handling multiple requests while waiting for asynchronous data requests to come back.&lt;br /&gt;
&amp;lt;lsl&amp;gt;integer scanning = FALSE;&lt;br /&gt;
&lt;br /&gt;
list requests;&lt;br /&gt;
&lt;br /&gt;
send_response(string body)&lt;br /&gt;
{&lt;br /&gt;
    integer j;&lt;br /&gt;
    for (j = 0; j &amp;lt; llGetListLength(requests); ++j)&lt;br /&gt;
    {&lt;br /&gt;
        llHTTPResponse(llList2Key(requests,j), 200, body);&lt;br /&gt;
    }&lt;br /&gt;
    requests = [];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            if (!scanning)&lt;br /&gt;
            {&lt;br /&gt;
                llSensor(&amp;quot;&amp;quot;,NULL_KEY,AGENT,96,PI);&lt;br /&gt;
                scanning = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            requests += [id];&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported method.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    no_sensor()&lt;br /&gt;
    {&lt;br /&gt;
        send_response(&amp;quot;There is no one here.&amp;quot;);&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    sensor(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        string output;&lt;br /&gt;
        if (n &amp;lt; 16) output = &amp;quot;There are &amp;quot; + (string)n + &amp;quot; avatars nearby:&amp;quot;;&lt;br /&gt;
        else output = &amp;quot;There are at least 16 avatars nearby:&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i = 0;i&amp;lt;n;++i)&lt;br /&gt;
        {&lt;br /&gt;
            output += &amp;quot;\n\t&amp;quot; + llDetectedName(i);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        send_response(output);&lt;br /&gt;
&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Url Persistence / Visitor Counter ===&lt;br /&gt;
A more complete &#039;hello world&#039;, always has an url and keeps a visitor counter.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
integer hits;&lt;br /&gt;
&lt;br /&gt;
setup()&lt;br /&gt;
{&lt;br /&gt;
    llSetObjectName(&amp;quot;HTTP Server&amp;quot;);&lt;br /&gt;
    url = &amp;quot;&amp;quot;;&lt;br /&gt;
    llRequestURL();&lt;br /&gt;
    hits = (integer)llGetObjectDesc();&lt;br /&gt;
    llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { setup(); }&lt;br /&gt;
    on_rez(integer n) { setup(); }&lt;br /&gt;
    &lt;br /&gt;
    changed(integer c)&lt;br /&gt;
    {&lt;br /&gt;
        if (c &amp;amp; (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )&lt;br /&gt;
        {&lt;br /&gt;
            setup();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    touch_start(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;My url is: &amp;quot; + url);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            url = body;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            ++hits;&lt;br /&gt;
            llSetObjectDesc((string)hits);&lt;br /&gt;
            llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello!  You are visitor &amp;quot; + (string)hits + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Method unsupported&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid.  ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL();     // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
     http_request(key id, string method, string body) {&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information from the outside: &amp;quot; + body);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Thank you for calling. All of our operators are busy.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the PERL script to contact the prim on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
    # First get the arguments.&lt;br /&gt;
    my $url = shift;&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    # Create the objects to be used to send out the HTTP request&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);&lt;br /&gt;
&lt;br /&gt;
    # Set the encoding method and specify the information to be sent.&lt;br /&gt;
    $request-&amp;gt;content_type(&#039;application/x-www-form-urlencoded&#039;);&lt;br /&gt;
    $request-&amp;gt;content(uri_escape($information));&lt;br /&gt;
&lt;br /&gt;
    # Send the request.&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);&lt;br /&gt;
&lt;br /&gt;
    # Return the information sent back&lt;br /&gt;
    return($response-&amp;gt;content);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,&#039;id=244195d6-c9b7-4fd6-9229-c3a8b2e60e81&amp;amp;name=M Linden&#039;);&lt;br /&gt;
&lt;br /&gt;
print $info,&amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the Python code that does the same thing as the PERL code above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    # Set the parameters to be sent.&lt;br /&gt;
    encodedParams =  urllib.urlencode(parameters);&lt;br /&gt;
&lt;br /&gt;
    # Post the data.&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);&lt;br /&gt;
&lt;br /&gt;
    # return the result.&lt;br /&gt;
    return(net.read());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;}&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST With Argument Parsing ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. In this example the scripts are adapted to handle the parsing of the arguments that are passed. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid. ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
// ###############################################&lt;br /&gt;
// Routine to parse a string sent through the &lt;br /&gt;
// http server via post.&lt;br /&gt;
//       parsePostData(theMessage)&lt;br /&gt;
// Returns a strided list with stride length 2.&lt;br /&gt;
// Each set has the key and then its value.&lt;br /&gt;
list parsePostData(string message) {&lt;br /&gt;
    list postData = [];         // The list with the data that was passed in.&lt;br /&gt;
    list parsedMessage = llParseString2List(message,[&amp;quot;&amp;amp;&amp;quot;],[]);    // The key/value pairs parsed into one list.&lt;br /&gt;
    integer len = ~llGetListLength(parsedMessage);&lt;br /&gt;
&lt;br /&gt;
    while(++len) {          &lt;br /&gt;
        string currentField = llList2String(parsedMessage, len); // Current key/value pair as a string.&lt;br /&gt;
&lt;br /&gt;
        integer split = llSubStringIndex(currentField,&amp;quot;=&amp;quot;);     // Find the &amp;quot;=&amp;quot; sign&lt;br /&gt;
        if(split == -1) { // There is only one field in this part of the message.&lt;br /&gt;
            postData += [llUnescapeURL(currentField),&amp;quot;&amp;quot;];  &lt;br /&gt;
        } else {&lt;br /&gt;
            postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    // Return the strided list.&lt;br /&gt;
    return postData ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL(); // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    http_request(key id, string method, string body) {&lt;br /&gt;
         list incomingMessage;&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + &lt;br /&gt;
                       body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information form the outside: &amp;quot; + body);&lt;br /&gt;
            incomingMessage = parsePostData(body);&lt;br /&gt;
            llOwnerSay(llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;You passed the following:\n&amp;quot; + &lt;br /&gt;
                           llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has&lt;br /&gt;
            // not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding PERL script for contacting the LSL script on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my $url = shift;                   # First get the arguments.&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;                # Create the object&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);   # used to send the&lt;br /&gt;
                                                      # HTTP request&lt;br /&gt;
&lt;br /&gt;
    $request-&amp;gt;content_type                            # Set the&lt;br /&gt;
	(&#039;application/x-www-form-urlencoded&#039;);        # encoding type.&lt;br /&gt;
    $request-&amp;gt;content(hash2URI($information));        # Set the content to&lt;br /&gt;
                                                      # send.&lt;br /&gt;
&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);       # Send the request.&lt;br /&gt;
    return($response-&amp;gt;content);                       # Return the&lt;br /&gt;
						      # information that&lt;br /&gt;
						      # was sent back&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #########################################################################&lt;br /&gt;
# Convert a hash to a url encoded string &lt;br /&gt;
#      hash2URI(\%hash)&lt;br /&gt;
sub hash2URI {&lt;br /&gt;
    my $theHash = shift;            # Get the arguments passed.&lt;br /&gt;
    my $encodedString = &#039;&#039;;         # The encoded string to return.&lt;br /&gt;
    my $lupe;                       # a loop variable.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    foreach $lupe (keys %{$theHash}) {                # &lt;br /&gt;
	$encodedString .= uri_escape($lupe) . &#039;=&#039; .   # Add each item in the&lt;br /&gt;
	    uri_escape($$theHash{$lupe}) . &#039;&amp;amp;&#039;;       # hash to the encoded string.&lt;br /&gt;
    }&lt;br /&gt;
    $encodedString =~ s/&amp;amp;$//;                         # Remove the trailing &amp;quot;&amp;amp;&amp;quot;&lt;br /&gt;
    return($encodedString);                           # Send the encoded string.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,{&#039;action&#039; =&amp;gt; &#039;send message&#039;,&lt;br /&gt;
	   &#039;value&#039;=&amp;gt; &#039;Hi there chief!&#039;,&lt;br /&gt;
	   &#039;id&#039;=&amp;gt;&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
	   &#039;name&#039;=&amp;gt;&#039;M Linden&#039;});&lt;br /&gt;
&lt;br /&gt;
print($info,&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding Python script. It does the same thing as the PERL script above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    &lt;br /&gt;
#    encodedParams =  urllib.urlencode(parameters);  # encode the parameters&lt;br /&gt;
    encodedParams  = dictionary2URI(parameters);    # encode the parameters&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);        # Post the data.&lt;br /&gt;
    return(net.read());                             # return the result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ################################################&lt;br /&gt;
# Routine to encode a dictionary without using &lt;br /&gt;
# &amp;quot;+&amp;quot; for spaces.&lt;br /&gt;
#       dictionary2URI(theDictionary)&lt;br /&gt;
def dictionary2URI(theDictionary) : &lt;br /&gt;
&lt;br /&gt;
    encoded = &#039;&#039;;           # Initialize the string to return&lt;br /&gt;
    for key, value in theDictionary.iteritems():&lt;br /&gt;
        # Encode each item in the dictionary.&lt;br /&gt;
        encoded += urllib.quote(key)+&amp;quot;=&amp;quot;+urllib.quote(value)+&amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    remove = re.compile(&#039;&amp;amp;$&#039;)             # Remove the trailing ampersand.&lt;br /&gt;
    encoded = remove.sub(&#039;&#039;,encoded);&lt;br /&gt;
&lt;br /&gt;
    return(encoded);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;,&lt;br /&gt;
                  &#039;action&#039;:&#039;send message&#039;,&lt;br /&gt;
                  &#039;value&#039;:&#039;Hey there, hi there, ho there!&#039;};&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;lsl&amp;gt;&amp;lt;/lsl&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple script for sending data to an LSL via PHP ===&lt;br /&gt;
This example by Simba Fuhr &#039;&#039;&#039;UPDATE April 16, 2011&#039;&#039;&#039;&lt;br /&gt;
{{Warning|Some hosting providers only allow fsockopen on the standard 80 and 443 ports.  This script will not work on those providers. If your provider is willing to open some ports for you, HTTP-in uses port 12046, and HTTPS-in uses port 12043.}}&lt;br /&gt;
&lt;br /&gt;
Secure URL Request with LSL.&lt;br /&gt;
Script returns the URL to itself. Please put this URL into your request from the PHP.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  llRequestSecureURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key id, string method, string body)&lt;br /&gt;
 {&lt;br /&gt;
  if ((method == URL_REQUEST_GRANTED))&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (method == &amp;quot;POST&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
   llHTTPResponse(id, 200, &amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the PHP.&lt;br /&gt;
A more advanced php function which supports complete url structures and automatical GET and POST types.&lt;br /&gt;
Just dont submit any post Data to make a GET request.&lt;br /&gt;
The Function supports any kind of url as secure and not secure (https and http).&lt;br /&gt;
If you dont submit a port in the url, the default port for http (80) and https (443) will be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo &amp;quot;LSL Script answered:&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
echo Advanced_HTTP_Request(&amp;quot;https://sim20557.agni.lindenlab.com:12043/cap/5851e666-b0c6-f0a0-758a-9e8156765215&amp;quot;, &amp;quot;Hello script, how are you ?&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
function Advanced_HTTP_Request($Host, $PostData = &amp;quot;&amp;quot;)&lt;br /&gt;
{&lt;br /&gt;
 $Method = &amp;quot;POST&amp;quot;;&lt;br /&gt;
 if (empty($PostData))&lt;br /&gt;
  {$Method = &amp;quot;GET&amp;quot;;}&lt;br /&gt;
 $Port = 80;&lt;br /&gt;
 if (strtolower(substr($Host, 0, 5)) == &amp;quot;https&amp;quot;)&lt;br /&gt;
  {$Port = 443;}&lt;br /&gt;
 $Host = explode(&amp;quot;//&amp;quot;, $Host, 2);&lt;br /&gt;
 if (count($Host) &amp;lt; 2)&lt;br /&gt;
  {$Host[1] = $Host[0];}&lt;br /&gt;
 $Host = explode(&amp;quot;/&amp;quot;, $Host[1], 2);&lt;br /&gt;
 if ($Port == 443)&lt;br /&gt;
  {$SSLAdd = &amp;quot;ssl://&amp;quot;;}&lt;br /&gt;
 $Host[0] = explode(&amp;quot;:&amp;quot;, $Host[0]);&lt;br /&gt;
 if (count($Host[0]) &amp;gt; 1)&lt;br /&gt;
 {&lt;br /&gt;
  $Port = $Host[0][1];&lt;br /&gt;
  $Host[0] = $Host[0][0];&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
  {$Host[0] = $Host[0][0];}&lt;br /&gt;
 $Socket = fsockopen($SSLAdd.$Host[0], $Port, $Dummy1, $Dummy2, 10);&lt;br /&gt;
 if ($Socket)&lt;br /&gt;
 {&lt;br /&gt;
  fputs($Socket, &amp;quot;$Method /$Host[1] HTTP/1.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Host: $Host[0]\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-type: application/x-www-form-urlencoded\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-length: &amp;quot;.strlen($PostData).&amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Connection: close\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 $PostData);&lt;br /&gt;
  $Tme = time();&lt;br /&gt;
  while(!feof($Socket) &amp;amp;&amp;amp; $Tme + 30 &amp;gt; time())&lt;br /&gt;
   {$Res = $Res.fgets($Socket, 256);}&lt;br /&gt;
  fclose($Socket);&lt;br /&gt;
 }&lt;br /&gt;
 $Res = explode(&amp;quot;\n\n&amp;quot;, $Res, 2);&lt;br /&gt;
 return $Res[1];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Kelly&#039;s Stupid Web Status Updater ===&lt;br /&gt;
Is actually on its own page: [[LSL_http_server/examples/kellys_stupid_web_status_updater | Kelly&#039;s Stupid Web Status Updater]]&amp;lt;br&amp;gt;&lt;br /&gt;
Kurai&#039;s mod from Kelly&#039;s stupid thing: [[LSL_http_server/examples/kurais_stupid_web_status_updater| Kurai&#039;s Stupid Web Status Updater Mod]]&lt;br /&gt;
{{LSLC|HTTP}}{{LSLC|Examples}}&lt;br /&gt;
&lt;br /&gt;
=== Grid URL Persister sample script ===&lt;br /&gt;
[[User:Opensource_Obscure/http/gridurl-sample|This script]] shows how to use the free &#039;&#039;[http://gridurl.appspot.com Grid URL Persister]&#039;&#039; web service in order to deal with LSL HTTP Server temporary URLs.&lt;br /&gt;
&lt;br /&gt;
=== Web-based dynamic buildings ===&lt;br /&gt;
HTTP-in may be used to easily send commands from a web page to an in-world object, so that web users can control and interact with buildings. The interactive installation &#039;&#039;Chromutate&#039;&#039; is based upon this idea: see its [[User:Opensource_Obscure/Chromutate|documentation page]] for free scripts and more details.&lt;br /&gt;
&lt;br /&gt;
=== PHP/SQL Object DNS ===&lt;br /&gt;
Simple DNS server written in PHP to facilitate a DNS service for LSL scripts&lt;br /&gt;
[[LSL_http_server/examples/phpdns|PHPDNS]]&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1140969</id>
		<title>LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=1140969"/>
		<updated>2011-04-16T11:18:14Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}&lt;br /&gt;
=== Utility Script ===&lt;br /&gt;
A script intended as a &#039;fill in the blank&#039; exercise for very, very simple HTTP servers is here: [[LSL_http_server/examples/utility_script | Utility Script]]&lt;br /&gt;
=== Hello World! ===&lt;br /&gt;
Classic example, the smallest http_request script possible.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
A slightly more robust version:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Echo World ===&lt;br /&gt;
&amp;quot;Echo World ([[User:Byrd Sciavo|Byrd Sciavo]] 04:19, 7 October 2009 (UTC))&amp;quot; is a slightly more useful &amp;quot;Hello World&amp;quot;, demonstrating a basic server that echos back dynamic data fed. Echo World shows how http_request receives GET variables. To receive this &amp;quot;dynamic echo&amp;quot;, append your cap url with a query string, such as https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry(){&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body){    &lt;br /&gt;
        if (method == URL_REQUEST_GRANTED) {&lt;br /&gt;
            url=body;llOwnerSay(url);&lt;br /&gt;
        }else if(method==&amp;quot;GET&amp;quot;){&lt;br /&gt;
              if(llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;)==&amp;quot;&amp;quot;) llHTTPResponse(id,200,&amp;quot;I ECHO when you append some GET variables to me, e.g., /?var=foo&amp;quot;);&lt;br /&gt;
              else llHTTPResponse(id,200,llGetHTTPHeader(id,&amp;quot;x-query-string&amp;quot;));&lt;br /&gt;
        }        &lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visitor List ===&lt;br /&gt;
A list of residents within sensor range of the server.&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
* This includes a method for handling multiple requests while waiting for asynchronous data requests to come back.&lt;br /&gt;
&amp;lt;lsl&amp;gt;integer scanning = FALSE;&lt;br /&gt;
&lt;br /&gt;
list requests;&lt;br /&gt;
&lt;br /&gt;
send_response(string body)&lt;br /&gt;
{&lt;br /&gt;
    integer j;&lt;br /&gt;
    for (j = 0; j &amp;lt; llGetListLength(requests); ++j)&lt;br /&gt;
    {&lt;br /&gt;
        llHTTPResponse(llList2Key(requests,j), 200, body);&lt;br /&gt;
    }&lt;br /&gt;
    requests = [];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            if (!scanning)&lt;br /&gt;
            {&lt;br /&gt;
                llSensor(&amp;quot;&amp;quot;,NULL_KEY,AGENT,96,PI);&lt;br /&gt;
                scanning = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            requests += [id];&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported method.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    no_sensor()&lt;br /&gt;
    {&lt;br /&gt;
        send_response(&amp;quot;There is no one here.&amp;quot;);&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    sensor(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        string output;&lt;br /&gt;
        if (n &amp;lt; 16) output = &amp;quot;There are &amp;quot; + (string)n + &amp;quot; avatars nearby:&amp;quot;;&lt;br /&gt;
        else output = &amp;quot;There are at least 16 avatars nearby:&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i = 0;i&amp;lt;n;++i)&lt;br /&gt;
        {&lt;br /&gt;
            output += &amp;quot;\n\t&amp;quot; + llDetectedName(i);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        send_response(output);&lt;br /&gt;
&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Url Persistence / Visitor Counter ===&lt;br /&gt;
A more complete &#039;hello world&#039;, always has an url and keeps a visitor counter.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
integer hits;&lt;br /&gt;
&lt;br /&gt;
setup()&lt;br /&gt;
{&lt;br /&gt;
    llSetObjectName(&amp;quot;HTTP Server&amp;quot;);&lt;br /&gt;
    url = &amp;quot;&amp;quot;;&lt;br /&gt;
    llRequestURL();&lt;br /&gt;
    hits = (integer)llGetObjectDesc();&lt;br /&gt;
    llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { setup(); }&lt;br /&gt;
    on_rez(integer n) { setup(); }&lt;br /&gt;
    &lt;br /&gt;
    changed(integer c)&lt;br /&gt;
    {&lt;br /&gt;
        if (c &amp;amp; (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )&lt;br /&gt;
        {&lt;br /&gt;
            setup();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    touch_start(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;My url is: &amp;quot; + url);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            url = body;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            ++hits;&lt;br /&gt;
            llSetObjectDesc((string)hits);&lt;br /&gt;
            llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello!  You are visitor &amp;quot; + (string)hits + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Method unsupported&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid.  ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL();     // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
     http_request(key id, string method, string body) {&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information from the outside: &amp;quot; + body);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Thank you for calling. All of our operators are busy.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the PERL script to contact the prim on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
    # First get the arguments.&lt;br /&gt;
    my $url = shift;&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    # Create the objects to be used to send out the HTTP request&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);&lt;br /&gt;
&lt;br /&gt;
    # Set the encoding method and specify the information to be sent.&lt;br /&gt;
    $request-&amp;gt;content_type(&#039;application/x-www-form-urlencoded&#039;);&lt;br /&gt;
    $request-&amp;gt;content(uri_escape($information));&lt;br /&gt;
&lt;br /&gt;
    # Send the request.&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);&lt;br /&gt;
&lt;br /&gt;
    # Return the information sent back&lt;br /&gt;
    return($response-&amp;gt;content);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,&#039;id=244195d6-c9b7-4fd6-9229-c3a8b2e60e81&amp;amp;name=M Linden&#039;);&lt;br /&gt;
&lt;br /&gt;
print $info,&amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the Python code that does the same thing as the PERL code above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    # Set the parameters to be sent.&lt;br /&gt;
    encodedParams =  urllib.urlencode(parameters);&lt;br /&gt;
&lt;br /&gt;
    # Post the data.&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);&lt;br /&gt;
&lt;br /&gt;
    # return the result.&lt;br /&gt;
    return(net.read());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;}&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST With Argument Parsing ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. In this example the scripts are adapted to handle the parsing of the arguments that are passed. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid. ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
// ###############################################&lt;br /&gt;
// Routine to parse a string sent through the &lt;br /&gt;
// http server via post.&lt;br /&gt;
//       parsePostData(theMessage)&lt;br /&gt;
// Returns a strided list with stride length 2.&lt;br /&gt;
// Each set has the key and then its value.&lt;br /&gt;
list parsePostData(string message) {&lt;br /&gt;
    list postData = [];         // The list with the data that was passed in.&lt;br /&gt;
    list parsedMessage = llParseString2List(message,[&amp;quot;&amp;amp;&amp;quot;],[]);    // The key/value pairs parsed into one list.&lt;br /&gt;
    integer len = ~llGetListLength(parsedMessage);&lt;br /&gt;
&lt;br /&gt;
    while(++len) {          &lt;br /&gt;
        string currentField = llList2String(parsedMessage, len); // Current key/value pair as a string.&lt;br /&gt;
&lt;br /&gt;
        integer split = llSubStringIndex(currentField,&amp;quot;=&amp;quot;);     // Find the &amp;quot;=&amp;quot; sign&lt;br /&gt;
        if(split == -1) { // There is only one field in this part of the message.&lt;br /&gt;
            postData += [llUnescapeURL(currentField),&amp;quot;&amp;quot;];  &lt;br /&gt;
        } else {&lt;br /&gt;
            postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    // Return the strided list.&lt;br /&gt;
    return postData ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL(); // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    http_request(key id, string method, string body) {&lt;br /&gt;
         list incomingMessage;&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + &lt;br /&gt;
                       body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information form the outside: &amp;quot; + body);&lt;br /&gt;
            incomingMessage = parsePostData(body);&lt;br /&gt;
            llOwnerSay(llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;You passed the following:\n&amp;quot; + &lt;br /&gt;
                           llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has&lt;br /&gt;
            // not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding PERL script for contacting the LSL script on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my $url = shift;                   # First get the arguments.&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;                # Create the object&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);   # used to send the&lt;br /&gt;
                                                      # HTTP request&lt;br /&gt;
&lt;br /&gt;
    $request-&amp;gt;content_type                            # Set the&lt;br /&gt;
	(&#039;application/x-www-form-urlencoded&#039;);        # encoding type.&lt;br /&gt;
    $request-&amp;gt;content(hash2URI($information));        # Set the content to&lt;br /&gt;
                                                      # send.&lt;br /&gt;
&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);       # Send the request.&lt;br /&gt;
    return($response-&amp;gt;content);                       # Return the&lt;br /&gt;
						      # information that&lt;br /&gt;
						      # was sent back&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #########################################################################&lt;br /&gt;
# Convert a hash to a url encoded string &lt;br /&gt;
#      hash2URI(\%hash)&lt;br /&gt;
sub hash2URI {&lt;br /&gt;
    my $theHash = shift;            # Get the arguments passed.&lt;br /&gt;
    my $encodedString = &#039;&#039;;         # The encoded string to return.&lt;br /&gt;
    my $lupe;                       # a loop variable.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    foreach $lupe (keys %{$theHash}) {                # &lt;br /&gt;
	$encodedString .= uri_escape($lupe) . &#039;=&#039; .   # Add each item in the&lt;br /&gt;
	    uri_escape($$theHash{$lupe}) . &#039;&amp;amp;&#039;;       # hash to the encoded string.&lt;br /&gt;
    }&lt;br /&gt;
    $encodedString =~ s/&amp;amp;$//;                         # Remove the trailing &amp;quot;&amp;amp;&amp;quot;&lt;br /&gt;
    return($encodedString);                           # Send the encoded string.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,{&#039;action&#039; =&amp;gt; &#039;send message&#039;,&lt;br /&gt;
	   &#039;value&#039;=&amp;gt; &#039;Hi there chief!&#039;,&lt;br /&gt;
	   &#039;id&#039;=&amp;gt;&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
	   &#039;name&#039;=&amp;gt;&#039;M Linden&#039;});&lt;br /&gt;
&lt;br /&gt;
print($info,&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding Python script. It does the same thing as the PERL script above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    &lt;br /&gt;
#    encodedParams =  urllib.urlencode(parameters);  # encode the parameters&lt;br /&gt;
    encodedParams  = dictionary2URI(parameters);    # encode the parameters&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);        # Post the data.&lt;br /&gt;
    return(net.read());                             # return the result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ################################################&lt;br /&gt;
# Routine to encode a dictionary without using &lt;br /&gt;
# &amp;quot;+&amp;quot; for spaces.&lt;br /&gt;
#       dictionary2URI(theDictionary)&lt;br /&gt;
def dictionary2URI(theDictionary) : &lt;br /&gt;
&lt;br /&gt;
    encoded = &#039;&#039;;           # Initialize the string to return&lt;br /&gt;
    for key, value in theDictionary.iteritems():&lt;br /&gt;
        # Encode each item in the dictionary.&lt;br /&gt;
        encoded += urllib.quote(key)+&amp;quot;=&amp;quot;+urllib.quote(value)+&amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    remove = re.compile(&#039;&amp;amp;$&#039;)             # Remove the trailing ampersand.&lt;br /&gt;
    encoded = remove.sub(&#039;&#039;,encoded);&lt;br /&gt;
&lt;br /&gt;
    return(encoded);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;,&lt;br /&gt;
                  &#039;action&#039;:&#039;send message&#039;,&lt;br /&gt;
                  &#039;value&#039;:&#039;Hey there, hi there, ho there!&#039;};&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;lsl&amp;gt;&amp;lt;/lsl&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple script for sending data to an LSL via PHP ===&lt;br /&gt;
This example by Simba Fuhr &#039;&#039;&#039;UPDATE April 16, 2011&#039;&#039;&#039;&lt;br /&gt;
{{Warning|Some hosting providers only allow fsockopen on the standard 80 and 443 ports.  This script will not work on those providers. If your provider is willing to open some ports for you, HTTP-in uses port 12046, and HTTPS-in uses port 12043.}}&lt;br /&gt;
&lt;br /&gt;
Secure URL Request with LSL.&lt;br /&gt;
Script returns the URL to itself. Please put this URL into your request from the PHP.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  llRequestSecureURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key id, string method, string body)&lt;br /&gt;
 {&lt;br /&gt;
  if ((method == URL_REQUEST_GRANTED))&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (method == &amp;quot;POST&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
   llHTTPResponse(id, 200, &amp;quot;PHP script sent: {&amp;quot; + body + &amp;quot;}&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the PHP.&lt;br /&gt;
A more advanced php function which supports complete url structures and automatical GET and POST types.&lt;br /&gt;
Just dont submit any post Data to make a GET request.&lt;br /&gt;
The Function supports any kind of url as secure and not secure (https and http).&lt;br /&gt;
If you dont submit a port in the url, the default port for http (80) and https (443) will be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo &amp;quot;LSL Script answered:&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
echo Advanced_HTTP_Request(&amp;quot;https://sim20557.agni.lindenlab.com:12043/cap/5851e666-b0c6-f0a0-758a-9e8156765215&amp;quot;, &amp;quot;Hello script, how are you ?&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
function Advanced_HTTP_Request($Host, $PostData = &amp;quot;&amp;quot;)&lt;br /&gt;
{&lt;br /&gt;
 $Method = &amp;quot;POST&amp;quot;;&lt;br /&gt;
 if (empty($PostData))&lt;br /&gt;
  {$Method = &amp;quot;GET&amp;quot;;}&lt;br /&gt;
 $Port = 80;&lt;br /&gt;
 if (strtolower(substr($Host, 0, 5)) == &amp;quot;https&amp;quot;)&lt;br /&gt;
  {$Port = 443;}&lt;br /&gt;
 $Host = explode(&amp;quot;//&amp;quot;, $Host, 2);&lt;br /&gt;
 if (count($Host) &amp;lt; 2)&lt;br /&gt;
  {$Host[1] = $Host[0];}&lt;br /&gt;
 $Host = explode(&amp;quot;/&amp;quot;, $Host[1], 2);&lt;br /&gt;
 if ($Port == 443)&lt;br /&gt;
  {$SSLAdd = &amp;quot;ssl://&amp;quot;;}&lt;br /&gt;
 $Host[0] = explode(&amp;quot;:&amp;quot;, $Host[0]);&lt;br /&gt;
 if (count($Host[0]) &amp;gt; 1)&lt;br /&gt;
 {&lt;br /&gt;
  $Port = $Host[0][1];&lt;br /&gt;
  $Host[0] = $Host[0][0];&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
  {$Host[0] = $Host[0][0];}&lt;br /&gt;
 $Socket = fsockopen($SSLAdd.$Host[0], $Port, $Dummy1, $Dummy2, 10);&lt;br /&gt;
 if ($Socket)&lt;br /&gt;
 {&lt;br /&gt;
  fputs($Socket, &amp;quot;$Method /$Host[1] HTTP/1.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Host: $Host[0]\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-type: application/x-www-form-urlencoded\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Content-length: &amp;quot;.strlen($PostData).&amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;Connection: close\r\n&amp;quot;.&lt;br /&gt;
				 &amp;quot;\r\n&amp;quot;.&lt;br /&gt;
				 $PostData);&lt;br /&gt;
  $Tme = time();&lt;br /&gt;
  while(!feof($Socket) &amp;amp;&amp;amp; $Tme + 30 &amp;gt; time())&lt;br /&gt;
   {$Res = $Res.fgets($Socket, 256);}&lt;br /&gt;
  fclose($Socket);&lt;br /&gt;
 }&lt;br /&gt;
 $Res = explode(&amp;quot;\n\n&amp;quot;, $Res, 2);&lt;br /&gt;
 return $Res[1];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Kelly&#039;s Stupid Web Status Updater ===&lt;br /&gt;
Is actually on its own page: [[LSL_http_server/examples/kellys_stupid_web_status_updater | Kelly&#039;s Stupid Web Status Updater]]&amp;lt;br&amp;gt;&lt;br /&gt;
Kurai&#039;s mod from Kelly&#039;s stupid thing: [[LSL_http_server/examples/kurais_stupid_web_status_updater| Kurai&#039;s Stupid Web Status Updater Mod]]&lt;br /&gt;
{{LSLC|HTTP}}{{LSLC|Examples}}&lt;br /&gt;
&lt;br /&gt;
=== Grid URL Persister sample script ===&lt;br /&gt;
[[User:Opensource_Obscure/http/gridurl-sample|This script]] shows how to use the free &#039;&#039;[http://gridurl.appspot.com Grid URL Persister]&#039;&#039; web service in order to deal with LSL HTTP Server temporary URLs.&lt;br /&gt;
&lt;br /&gt;
=== Web-based dynamic buildings ===&lt;br /&gt;
HTTP-in may be used to easily send commands from a web page to an in-world object, so that web users can control and interact with buildings. The interactive installation &#039;&#039;Chromutate&#039;&#039; is based upon this idea: see its [[User:Opensource_Obscure/Chromutate|documentation page]] for free scripts and more details.&lt;br /&gt;
&lt;br /&gt;
=== PHP/SQL Object DNS ===&lt;br /&gt;
Simple DNS server written in PHP to facilitate a DNS service for LSL scripts&lt;br /&gt;
[[LSL_http_server/examples/phpdns|PHPDNS]]&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=User:Strife_Onizuka/Sandbox/Nest&amp;diff=1138108</id>
		<title>User:Strife Onizuka/Sandbox/Nest</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=User:Strife_Onizuka/Sandbox/Nest&amp;diff=1138108"/>
		<updated>2011-03-21T18:39:33Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{User:Strife Onizuka/Sandbox/Nest2|mode=user|inject-2={{Issues/SVC-215}}{{User:Strife Onizuka/Sandbox}}{{LSL_Function/uuid|id|sim=*}}&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://n2k.danardlabs.com (SSL, {{LSLGC|Legacy Name|Legacy Names}} &amp;amp; {{LSLGC|Username|Usernames}} supported)&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&lt;br /&gt;
*http://kubwa.net/index.php?cmd=name2key (Bot based name2key Database. Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name/ja&amp;diff=1138107</id>
		<title>LlKey2Name/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name/ja&amp;diff=1138107"/>
		<updated>2011-03-21T18:38:51Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function/uuid/ja|id|sim=*}}{{LSL_Function/ja&lt;br /&gt;
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; には、現在あるか、もしくはスクリプトが実行されている時に SIM にあるとわかっている、 rez されたオブジェクトかアバターの正しいキーを指定しなければならず、そうでなければ空の文字列が返ります。アバターの場合、アバターが SIM の子となるエージェントであるか (つまり、隣接している SIM にいるが、現在スクリプトが入っているものを覗くことができる状態) 、もしくは当該 SIM を離れて間もない場合 (仕様上、クライアントが、メインまたは子のエージェントとして、 SIM から完全に切断されたとき) 、この関数は依然として正しい名前を返します。  &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
インベントリアイテムのキーでは動作しません。この場合、代わりに {{LSLG/ja|llGetInventoryName}} を使ってください。&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=&#039;&#039;&#039;id&#039;&#039;&#039; で指定されたプリムまたはアバターの{{LSLGC|Avatar/Name/ja|名前}}&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* 空の文字列を名前にもつプリムと SIM に存在しないプリム、もしくは不正なキーが指定されたために空の文字列が返っていることの区別をつけるのは困難です。この問題を回避するには、 {{LSLG/ja|llGetObjectDetails}} を使用してください。&lt;br /&gt;
* 「アバターがいなければならない」制約を回避するために、 {{LSLG/ja|llRequestAgentData}} 関数と {{LSLG/ja|dataserver}} イベントを使って、キーからアバターの名前を取得することができます。&lt;br /&gt;
* 逆の関数 ({{LSLG|llName2Key}}) は使用できません。しかし、 {{LSLG/ja|llHTTPRequest}} 関数と {{LSLG/ja|http_response}} イベントを使って問い合わせを行うことのできる、サードパーティの Web サイトがあります。&lt;br /&gt;
* アバターが（ずっとあるサーバのバグが原因となって時々起こる）幽霊状態になると、アバターが実質そこにいて {{LSLG/ja|llSensor}} や[[Mini-Map|ミニマップ]]で表示されていても、空文字列が返ります。この原理を応用して[[Ghost Detector|幽霊発見器]]スクリプトを作ることができます。&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// チャット履歴 (ctrl-h) で最適な表示&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//誰がぶつかったかアナウンスします&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||{{LSLG/ja|llGetUsername}}}}&lt;br /&gt;
{{LSL DefineRow||{{LSLG/ja|llGetDisplayName}}}}&lt;br /&gt;
{{LSL DefineRow||{{LSLG/ja|llGetObjectDetails}}}}&lt;br /&gt;
{{LSL DefineRow||{{LSLG/ja|llRequestAgentData}}|{{LSLG/ja|dataserver}} を使ってアバターの情報を取得します}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;アクティブな Name2Key データベース:&#039;&#039;&#039;&lt;br /&gt;
*http://n2k.danardlabs.com (SSL, {{LSLGC/ja|Legacy Name|レガシーネーム}} と {{LSLGC/ja|Username|ユーザネーム}} がサポートされています)&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://wiki.apez.biz/Development (Web サービス API 関数 getAvatarKey と getAvatarName)&lt;br /&gt;
*http://kubwa.net/index.php?cmd=name2key (ボットベースの name2key データベースです。{{LSLGC/ja|Legacy Name|レガシーネーム}} と {{LSLGC/ja|Username|ユーザネーム}} のフォーマットに対応しています)&lt;br /&gt;
&#039;&#039;&#039;Name2Key ライブラリ:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1138106</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1138106"/>
		<updated>2011-03-21T18:37:06Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://n2k.danardlabs.com (SSL, {{LSLGC|Legacy Name|Legacy Names}} &amp;amp; {{LSLGC|Username|Usernames}} supported)&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&lt;br /&gt;
*http://kubwa.net/index.php?cmd=name2key (Bot based name2key Database. Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1112582</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1112582"/>
		<updated>2010-11-22T15:00:43Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}{{LSL_Function&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&lt;br /&gt;
*http://insl.kubwa.de/name2key.php?name=name (Bot based name2key Database. Supports: &amp;quot;First Last&amp;quot;; &amp;quot;First.Last&amp;quot;; &amp;quot;First&amp;quot; instead of &amp;quot;First Resident&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1112023</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1112023"/>
		<updated>2010-11-21T10:00:29Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}{{LSL_Function&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&lt;br /&gt;
*http://insl.kubwa.de/name2key.php?name=name (Bot based and display names ready name2key database, if lastname is missing in url it will be automatically &#039;Resident&#039;)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1105063</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1105063"/>
		<updated>2010-11-13T09:15:53Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}{{LSL_Function&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&lt;br /&gt;
*http://insl.kubwa.de/name2key.php?name=name (Bot based and display names ready name2key database)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1105053</id>
		<title>LlKey2Name</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlKey2Name&amp;diff=1105053"/>
		<updated>2010-11-13T09:13:37Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}{{LSL_Function&lt;br /&gt;
|func_id=210|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|sort=Key2Name|func=llKey2Name&lt;br /&gt;
|return_type=string|p1_type=key|p1_name=id&lt;br /&gt;
|func_footnote=&#039;&#039;&#039;id&#039;&#039;&#039; must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by &#039;&#039;&#039;id&#039;&#039;&#039;.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.&lt;br /&gt;
* To get around the &amp;quot;avatar must be present&amp;quot; limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar&#039;s name from a key.&lt;br /&gt;
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.&lt;br /&gt;
* If an avatar is &amp;quot;ghosted&amp;quot; (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    collision_start(integer a)//Announce who collided&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
    touch_start(integer a)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;llKey2Name: &amp;quot; + llKey2Name(llDetectedKey(0)) +&lt;br /&gt;
               &amp;quot;\nllDetectedName: &amp;quot; + llDetectedName(0));&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llGetUsername]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetDisplayName]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetObjectDetails]]}}&lt;br /&gt;
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[Prim Attribute Overloading]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|notes=&#039;&#039;&#039;Active Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*http://w-hat.com/name2key&lt;br /&gt;
*http://kdc.ethernia.net/sys/name2key.php&lt;br /&gt;
*http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)&lt;br /&gt;
*http://insl.kubwa.de/name2key.php?name=[name] (Bot based name2key database)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Dead Name2Key Databases:&#039;&#039;&#039;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.libsecondlife.org/protocol/index.php/Name2key&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;s&amp;gt;http://www.ulrikasheim.org/tools/name2key.html&amp;lt;/s&amp;gt;&amp;lt;font color=red&amp;gt;(Appears to be gone as of Apr 2008)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name2Key Libraries:&#039;&#039;&#039;&lt;br /&gt;
*[[Name2Key_in_LSL]]&lt;br /&gt;
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik&#039;s Name2Key PHP script]]&lt;br /&gt;
|cat1=Avatar&lt;br /&gt;
|cat2=Prim&lt;br /&gt;
|cat3=Key&lt;br /&gt;
|cat4=Avatar/Name&lt;br /&gt;
|cat5=Legacy Name&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=Talk:Display_Names/LSL&amp;diff=1012452</id>
		<title>Talk:Display Names/LSL</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=Talk:Display_Names/LSL&amp;diff=1012452"/>
		<updated>2010-08-19T11:08:07Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: Created page with &amp;#039;I have a Name2Key database to deliver gifts and to link registred users on my website to their SL account. The Name2Key Database does a namesearch lookup with a bot, if the name ...&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I have a Name2Key database to deliver gifts and to link registred users on my website to their SL account. The Name2Key Database does a namesearch lookup with a bot, if the name could not be found in the database. Will the namesearch lookup find the display names or the real names ? And whats when there are multiple people are using the same display name ?&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=481282</id>
		<title>LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=481282"/>
		<updated>2009-09-04T12:03:18Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}&lt;br /&gt;
=== Utility Script ===&lt;br /&gt;
A script intended as a &#039;fill in the blank&#039; exercise for very, very simple HTTP servers is here: [[LSL_http_server/examples/utility_script | Utility Script]]&lt;br /&gt;
=== Hello World! ===&lt;br /&gt;
Classic example, the smallest http_request script possible.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
A slightly more robust version:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visitor List ===&lt;br /&gt;
A list of residents within sensor range of the server.&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
* This includes a method for handling multiple requests while waiting for asynchronous data requests to come back.&lt;br /&gt;
&amp;lt;lsl&amp;gt;integer scanning = FALSE;&lt;br /&gt;
&lt;br /&gt;
list requests;&lt;br /&gt;
&lt;br /&gt;
send_response(string body)&lt;br /&gt;
{&lt;br /&gt;
    integer j;&lt;br /&gt;
    for (j = 0; j &amp;lt; llGetListLength(requests); ++j)&lt;br /&gt;
    {&lt;br /&gt;
        llHTTPResponse(llList2Key(requests,j), 200, body);&lt;br /&gt;
    }&lt;br /&gt;
    requests = [];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            if (!scanning)&lt;br /&gt;
            {&lt;br /&gt;
                llSensor(&amp;quot;&amp;quot;,NULL_KEY,AGENT,96,PI);&lt;br /&gt;
                scanning = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            requests += [id];&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported method.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    no_sensor()&lt;br /&gt;
    {&lt;br /&gt;
        send_response(&amp;quot;There is no one here.&amp;quot;);&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    sensor(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        string output;&lt;br /&gt;
        if (n &amp;lt; 16) output = &amp;quot;There are &amp;quot; + (string)n + &amp;quot; avatars nearby:&amp;quot;;&lt;br /&gt;
        else output = &amp;quot;There are at least 16 avatars nearby:&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i = 0;i&amp;lt;n;++i)&lt;br /&gt;
        {&lt;br /&gt;
            output += &amp;quot;\n\t&amp;quot; + llDetectedName(i);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        send_response(output);&lt;br /&gt;
&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Url Persistence / Visitor Counter ===&lt;br /&gt;
A more complete &#039;hello world&#039;, always has an url and keeps a visitor counter.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
integer hits;&lt;br /&gt;
&lt;br /&gt;
setup()&lt;br /&gt;
{&lt;br /&gt;
    llSetObjectName(&amp;quot;HTTP Server&amp;quot;);&lt;br /&gt;
    url = &amp;quot;&amp;quot;;&lt;br /&gt;
    llRequestURL();&lt;br /&gt;
    hits = (integer)llGetObjectDesc();&lt;br /&gt;
    llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { setup(); }&lt;br /&gt;
    on_rez(integer n) { setup(); }&lt;br /&gt;
    &lt;br /&gt;
    changed(integer c)&lt;br /&gt;
    {&lt;br /&gt;
        if (c &amp;amp; (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )&lt;br /&gt;
        {&lt;br /&gt;
            setup();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    touch_start(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;My url is: &amp;quot; + url);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            url = body;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            ++hits;&lt;br /&gt;
            llSetObjectDesc((string)hits);&lt;br /&gt;
            llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello!  You are visitor &amp;quot; + (string)hits + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Method unsupported&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid.  ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL();     // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
     http_request(key id, string method, string body) {&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information from the outside: &amp;quot; + body);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Thank you for calling. All of our operators are busy.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the PERL script to contact the prim on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
    # First get the arguments.&lt;br /&gt;
    my $url = shift;&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    # Create the objects to be used to send out the HTTP request&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);&lt;br /&gt;
&lt;br /&gt;
    # Set the encoding method and specify the information to be sent.&lt;br /&gt;
    $request-&amp;gt;content_type(&#039;application/x-www-form-urlencoded&#039;);&lt;br /&gt;
    $request-&amp;gt;content(uri_escape($information));&lt;br /&gt;
&lt;br /&gt;
    # Send the request.&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);&lt;br /&gt;
&lt;br /&gt;
    # Return the information sent back&lt;br /&gt;
    return($response-&amp;gt;content);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,&#039;id=244195d6-c9b7-4fd6-9229-c3a8b2e60e81&amp;amp;name=M Linden&#039;);&lt;br /&gt;
&lt;br /&gt;
print $info,&amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the Python code that does the same thing as the PERL code above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    # Set the parameters to be sent.&lt;br /&gt;
    encodedParams =  urllib.urlencode(parameters);&lt;br /&gt;
&lt;br /&gt;
    # Post the data.&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);&lt;br /&gt;
&lt;br /&gt;
    # return the result.&lt;br /&gt;
    return(net.read());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;}&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST With Argument Parsing ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. In this example the scripts are adapted to handle the parsing of the arguments that are passed. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid. ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
// ###############################################&lt;br /&gt;
// Routine to parse a string sent through the &lt;br /&gt;
// http server via post.&lt;br /&gt;
//       parsePostData(theMessage)&lt;br /&gt;
// Returns a strided list with stride length 2.&lt;br /&gt;
// Each set has the key and then its value.&lt;br /&gt;
list parsePostData(string message) {&lt;br /&gt;
    list postData = [];         // The list with the data that was passed in.&lt;br /&gt;
    list parsedMessage = llParseString2List(message,[&amp;quot;&amp;amp;&amp;quot;],[]);    // The key/value pairs parsed into one list.&lt;br /&gt;
    integer len = ~llGetListLength(parsedMessage);&lt;br /&gt;
&lt;br /&gt;
    while(++len) {          &lt;br /&gt;
        string currentField = llList2String(parsedMessage, len); // Current key/value pair as a string.&lt;br /&gt;
&lt;br /&gt;
        integer split = llSubStringIndex(currentField,&amp;quot;=&amp;quot;);     // Find the &amp;quot;=&amp;quot; sign&lt;br /&gt;
        if(split == -1) { // There is only one field in this part of the message.&lt;br /&gt;
            postData += [llUnescapeURL(currentField),&amp;quot;&amp;quot;];  &lt;br /&gt;
        } else {&lt;br /&gt;
            postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    // Return the strided list.&lt;br /&gt;
    return postData ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL(); // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    http_request(key id, string method, string body) {&lt;br /&gt;
         list incomingMessage;&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + &lt;br /&gt;
                       body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information form the outside: &amp;quot; + body);&lt;br /&gt;
            incomingMessage = parsePostData(body);&lt;br /&gt;
            llOwnerSay(llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;You passed the following:\n&amp;quot; + &lt;br /&gt;
                           llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has&lt;br /&gt;
            // not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding PERL script for contacting the LSL script on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my $url = shift;                   # First get the arguments.&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;                # Create the object&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);   # used to send the&lt;br /&gt;
                                                      # HTTP request&lt;br /&gt;
&lt;br /&gt;
    $request-&amp;gt;content_type                            # Set the&lt;br /&gt;
	(&#039;application/x-www-form-urlencoded&#039;);        # encoding type.&lt;br /&gt;
    $request-&amp;gt;content(hash2URI($information));        # Set the content to&lt;br /&gt;
                                                      # send.&lt;br /&gt;
&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);       # Send the request.&lt;br /&gt;
    return($response-&amp;gt;content);                       # Return the&lt;br /&gt;
						      # information that&lt;br /&gt;
						      # was sent back&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #########################################################################&lt;br /&gt;
# Convert a hash to a url encoded string &lt;br /&gt;
#      hash2URI(\%hash)&lt;br /&gt;
sub hash2URI {&lt;br /&gt;
    my $theHash = shift;            # Get the arguments passed.&lt;br /&gt;
    my $encodedString = &#039;&#039;;         # The encoded string to return.&lt;br /&gt;
    my $lupe;                       # a loop variable.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    foreach $lupe (keys %{$theHash}) {                # &lt;br /&gt;
	$encodedString .= uri_escape($lupe) . &#039;=&#039; .   # Add each item in the&lt;br /&gt;
	    uri_escape($$theHash{$lupe}) . &#039;&amp;amp;&#039;;       # hash to the encoded string.&lt;br /&gt;
    }&lt;br /&gt;
    $encodedString =~ s/&amp;amp;$//;                         # Remove the trailing &amp;quot;&amp;amp;&amp;quot;&lt;br /&gt;
    return($encodedString);                           # Send the encoded string.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,{&#039;action&#039; =&amp;gt; &#039;send message&#039;,&lt;br /&gt;
	   &#039;value&#039;=&amp;gt; &#039;Hi there chief!&#039;,&lt;br /&gt;
	   &#039;id&#039;=&amp;gt;&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
	   &#039;name&#039;=&amp;gt;&#039;M Linden&#039;});&lt;br /&gt;
&lt;br /&gt;
print($info,&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding Python script. It does the same thing as the PERL script above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    &lt;br /&gt;
#    encodedParams =  urllib.urlencode(parameters);  # encode the parameters&lt;br /&gt;
    encodedParams  = dictionary2URI(parameters);    # encode the parameters&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);        # Post the data.&lt;br /&gt;
    return(net.read());                             # return the result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ################################################&lt;br /&gt;
# Routine to encode a dictionary without using &lt;br /&gt;
# &amp;quot;+&amp;quot; for spaces.&lt;br /&gt;
#       dictionary2URI(theDictionary)&lt;br /&gt;
def dictionary2URI(theDictionary) : &lt;br /&gt;
&lt;br /&gt;
    encoded = &#039;&#039;;           # Initialize the string to return&lt;br /&gt;
    for key, value in theDictionary.iteritems():&lt;br /&gt;
        # Encode each item in the dictionary.&lt;br /&gt;
        encoded += urllib.quote(key)+&amp;quot;=&amp;quot;+urllib.quote(value)+&amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    remove = re.compile(&#039;&amp;amp;$&#039;)             # Remove the trailing ampersand.&lt;br /&gt;
    encoded = remove.sub(&#039;&#039;,encoded);&lt;br /&gt;
&lt;br /&gt;
    return(encoded);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;,&lt;br /&gt;
                  &#039;action&#039;:&#039;send message&#039;,&lt;br /&gt;
                  &#039;value&#039;:&#039;Hey there, hi there, ho there!&#039;};&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;lsl&amp;gt;&amp;lt;/lsl&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple script for sending data to an LSL via PHP ===&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  llRequestURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key id, string method, string body)&lt;br /&gt;
 {&lt;br /&gt;
  if ((method == URL_REQUEST_GRANTED))&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (method == &amp;quot;POST&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
   llHTTPResponse(id, 200, body + &amp;quot; there !&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the PHP.&lt;br /&gt;
It sends &amp;quot;Hello&amp;quot; to the LSL Script which adds &amp;quot; there !&amp;quot; and returns it, so the php will return &amp;quot;Hello there !&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$Data = CallLSLScript(&amp;quot;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&amp;quot;, &amp;quot;Hello&amp;quot;);&lt;br /&gt;
die($Data);&lt;br /&gt;
&lt;br /&gt;
//Function by Simba Fuhr&lt;br /&gt;
//Use under the GPL License&lt;br /&gt;
function CallLSLScript($URL, $Data, $Timeout = 10)&lt;br /&gt;
{&lt;br /&gt;
 //Parse the URL into Server, Path and Port&lt;br /&gt;
 $Host = str_ireplace(&amp;quot;http://&amp;quot;, &amp;quot;&amp;quot;, $URL);&lt;br /&gt;
 $Path = explode(&amp;quot;/&amp;quot;, $Host, 2);&lt;br /&gt;
 $Host = $Path[0];&lt;br /&gt;
 $Path = $Path[1];&lt;br /&gt;
 $PrtSplit = explode(&amp;quot;:&amp;quot;, $Host);&lt;br /&gt;
 $Host = $PrtSplit[0];&lt;br /&gt;
 $Port = $PrtSplit[1];&lt;br /&gt;
 &lt;br /&gt;
 //Open Connection&lt;br /&gt;
 $Socket = fsockopen($Host, $Port, $Dummy1, $Dummy2, $Timeout);&lt;br /&gt;
 if ($Socket)&lt;br /&gt;
 {&lt;br /&gt;
  //Send Header and Data&lt;br /&gt;
  fputs($Socket, &amp;quot;POST /$Path HTTP/1.1\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Host: $Host\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Content-type: application/x-www-form-urlencoded\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Content-length: &amp;quot;.strlen($Data).&amp;quot;\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Connection: close\r\n\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, $Data);&lt;br /&gt;
   &lt;br /&gt;
  //Receive Data&lt;br /&gt;
  while(!feof($Socket))&lt;br /&gt;
   {$res .= fgets($Socket, 128);}&lt;br /&gt;
  fclose($Socket);&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 //ParseData and return it&lt;br /&gt;
 $res = explode(&amp;quot;\r\n\r\n&amp;quot;, $res);&lt;br /&gt;
 return $res[1];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Kelly&#039;s Stupid Web Status Updater ===&lt;br /&gt;
Is actually on its own page: [[LSL_http_server/examples/kellys_stupid_web_status_updater | Kelly&#039;s Stupid Web Status Updater]]&amp;lt;br&amp;gt;&lt;br /&gt;
Kurai&#039;s mod from Kelly&#039;s stupid thing: [[LSL_http_server/examples/kurais_stupid_web_status_updater| Kurai&#039;s Stupid Web Status Updater Mod]]&lt;br /&gt;
{{LSLC|HTTP}}{{LSLC|Examples}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlRequestURL&amp;diff=474802</id>
		<title>LlRequestURL</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlRequestURL&amp;diff=474802"/>
		<updated>2009-08-29T16:33:52Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|func_id=345|func_sleep=0.0|func_energy=10.0|mode&lt;br /&gt;
|func=llRequestURL|return_type=key&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Requests one HTTP:// url for use by this object. The [[http_request]] event is triggered with the results.&lt;br /&gt;
|return_text=that is the handle used for identifying the request in the [[http_request]] event.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=*When a region is (re)started all [[http_request|HTTP server]] URLs are automatically released and invalidated.&lt;br /&gt;
**Use [[CHANGED_REGION_START]] to detect this so new URL can be requested.&lt;br /&gt;
*An old URL MUST be released first by using [[llReleaseURL]] if you are requesting an new one (where the reason for is not a region restart) or it will be still active and you are losing free URLs.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
Requesting a new URL after region restart:&lt;br /&gt;
&amp;lt;LSL&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  //Requesting a URL&lt;br /&gt;
  llRequestURL();&lt;br /&gt;
 }&lt;br /&gt;
 changed(integer What)&lt;br /&gt;
 {&lt;br /&gt;
  //Resgion restartet&lt;br /&gt;
  if (What &amp;amp; CHANGED_REGION_START)&lt;br /&gt;
  {&lt;br /&gt;
   //Request new URL&lt;br /&gt;
   llRequestURL();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key ID, string Method, string Body)&lt;br /&gt;
 {&lt;br /&gt;
  if (Method == URL_REQUEST_GRANTED)&lt;br /&gt;
  {&lt;br /&gt;
   //Saying URL to owner&lt;br /&gt;
   llOwnerSay(Body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (Method == URL_REQUEST_DENIED)&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;No URLs free !&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  else if (Method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
   {llHTTPResponse(ID, 200, &amp;quot;Hello there !&amp;quot;);}&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/LSL&amp;gt;&lt;br /&gt;
Here the old URL will be released anytime when the region restarts.&lt;br /&gt;
&lt;br /&gt;
If you want to request a new URL and the region is not restarted you need to store the old one and release it manually before requesting a new one or your limit on free URLs will be down quick.&lt;br /&gt;
&lt;br /&gt;
Try the following code ONLY if you can use all your URLs on your land.&lt;br /&gt;
Removing the prim/script will release all URLs previous assigned.&lt;br /&gt;
&amp;lt;LSL&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  //Requesting a URL&lt;br /&gt;
  llRequestURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key ID, string Method, string Body)&lt;br /&gt;
 {&lt;br /&gt;
  if (Method == URL_REQUEST_GRANTED)&lt;br /&gt;
  {&lt;br /&gt;
   //Printing new URL and free adresses&lt;br /&gt;
   llSetText((string)llGetFreeURLs() + &amp;quot;\n&amp;quot; + Body, &amp;lt;1, 1, 1&amp;gt;, 1);&lt;br /&gt;
   //Requesting a URL&lt;br /&gt;
   llRequestURL();&lt;br /&gt;
  }&lt;br /&gt;
  else if (Method == URL_REQUEST_DENIED)&lt;br /&gt;
  {&lt;br /&gt;
   llSetText(&amp;quot;No URLs free !&amp;quot;, &amp;lt;1, 0, 0&amp;gt;, 1);&lt;br /&gt;
  }&lt;br /&gt;
  else if (Method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
   {llHTTPResponse(ID, 200, &amp;quot;Hello there !&amp;quot;);}&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/LSL&amp;gt;&lt;br /&gt;
This script will, as you can see, use all URLs available on your land because it does not remove the old URLs before requesting a new one.&lt;br /&gt;
Just store the old URL in a global variable and release it with [[llReleaseURL]].&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llRequestSecureURL]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetFreeURLs]]}}&lt;br /&gt;
{{LSL DefineRow||[[llReleaseURL]]}}&lt;br /&gt;
{{LSL DefineRow||[[llHTTPResponse]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetHTTPHeader]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[LSL http server]]}}&lt;br /&gt;
|notes&lt;br /&gt;
|deepnotes=&lt;br /&gt;
|history=&lt;br /&gt;
*{{SVN|1836|rev=112899 |trunk=*|anchor=file22|ver=|ser=}}&lt;br /&gt;
|cat1=HTTP&lt;br /&gt;
|cat2=HTTP/Server&lt;br /&gt;
|cat3&lt;br /&gt;
|cat4&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlRequestURL&amp;diff=474782</id>
		<title>LlRequestURL</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlRequestURL&amp;diff=474782"/>
		<updated>2009-08-29T16:04:01Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|func_id=345|func_sleep=0.0|func_energy=10.0|mode&lt;br /&gt;
|func=llRequestURL|return_type=key&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Requests one HTTP:// url for use by this object. The [[http_request]] event is triggered with the results.&lt;br /&gt;
|return_text=that is the handle used for identifying the request in the [[http_request]] event.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=*When a region is (re)started all [[http_request|HTTP server]] URLs are automatically released and invalidated.&lt;br /&gt;
**Use [[CHANGED_REGION_START]] to detect this so new URL can be requested.&lt;br /&gt;
*An old URL MUST be released first by using [[llReleaseURL]] if you are requesting an new one (where the reason for is not a region restart) or it will be still active and you are losing free URLs.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
Requesting a new URL after region restart:&lt;br /&gt;
&amp;lt;LSL&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  //Requesting a URL&lt;br /&gt;
  llRequestURL();&lt;br /&gt;
 }&lt;br /&gt;
 changed(integer What)&lt;br /&gt;
 {&lt;br /&gt;
  //Resgion restartet&lt;br /&gt;
  if (What &amp;amp; CHANGED_REGION_START)&lt;br /&gt;
  {&lt;br /&gt;
   //Request new URL&lt;br /&gt;
   llRequestURL();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key ID, string Method, string Body)&lt;br /&gt;
 {&lt;br /&gt;
  if (Method == URL_REQUEST_GRANTED)&lt;br /&gt;
  {&lt;br /&gt;
   //Saying URL to owner&lt;br /&gt;
   llOwnerSay(Body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (Method == URL_REQUEST_DENIED)&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;No URLs free !&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  else if (Method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
   {llHTTPResponse(ID, 200, &amp;quot;Hello there !&amp;quot;);}&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/LSL&amp;gt;&lt;br /&gt;
Here the old URL will be released anytime when the region restarts.&lt;br /&gt;
&lt;br /&gt;
If you want to request a new URL and the region is not restarted you need to store the old one and release it manually before requesting a new one or your limit on free URLs will be down quick.&lt;br /&gt;
&lt;br /&gt;
Try the following code ONLY if you can use all your URLs on your land.&lt;br /&gt;
Removing the prim/script will release all URLs previous assigned.&lt;br /&gt;
&amp;lt;LSL&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  //Requesting a URL&lt;br /&gt;
  llRequestURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key ID, string Method, string Body)&lt;br /&gt;
 {&lt;br /&gt;
  if (Method == URL_REQUEST_GRANTED)&lt;br /&gt;
  {&lt;br /&gt;
   //Printing new URL and free adresses&lt;br /&gt;
   llSetText((string)llGetFreeURLs() + &amp;quot;\n&amp;quot; + Body, &amp;lt;1, 1, 1&amp;gt;, 1);&lt;br /&gt;
  }&lt;br /&gt;
  else if (Method == URL_REQUEST_DENIED)&lt;br /&gt;
  {&lt;br /&gt;
   llSetText(&amp;quot;No URLs free !&amp;quot;, &amp;lt;1, 0, 0&amp;gt;, 1);&lt;br /&gt;
  }&lt;br /&gt;
  else if (Method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
   {llHTTPResponse(ID, 200, &amp;quot;Hello there !&amp;quot;);}&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/LSL&amp;gt;&lt;br /&gt;
This script will, as you can see, use all URLs available on your land because it does not remove the old URLs before requesting a new one.&lt;br /&gt;
Just store the old URL in a global variable and release it with [[llReleaseURL]].&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llRequestSecureURL]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetFreeURLs]]}}&lt;br /&gt;
{{LSL DefineRow||[[llReleaseURL]]}}&lt;br /&gt;
{{LSL DefineRow||[[llHTTPResponse]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetHTTPHeader]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[LSL http server]]}}&lt;br /&gt;
|notes&lt;br /&gt;
|deepnotes=&lt;br /&gt;
|history=&lt;br /&gt;
*{{SVN|1836|rev=112899 |trunk=*|anchor=file22|ver=|ser=}}&lt;br /&gt;
|cat1=HTTP&lt;br /&gt;
|cat2=HTTP/Server&lt;br /&gt;
|cat3&lt;br /&gt;
|cat4&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlRequestURL&amp;diff=474762</id>
		<title>LlRequestURL</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlRequestURL&amp;diff=474762"/>
		<updated>2009-08-29T15:52:41Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|func_id=345|func_sleep=0.0|func_energy=10.0|mode&lt;br /&gt;
|func=llRequestURL|return_type=key&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Requests one HTTP:// url for use by this object. The [[http_request]] event is triggered with the results.&lt;br /&gt;
|return_text=that is the handle used for identifying the request in the [[http_request]] event.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=*When a region is (re)started all [[http_request|HTTP server]] URLs are automatically released and invalidated.&lt;br /&gt;
**Use [[CHANGED_REGION_START]] to detect this so new URL can be requested.&lt;br /&gt;
*An old URL MUST be released first by using [[llReleaseURL]] if you are requesting an new one (where the reason for is not a region reboot) or it will be still active and you are losing free URLs.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llRequestSecureURL]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetFreeURLs]]}}&lt;br /&gt;
{{LSL DefineRow||[[llReleaseURL]]}}&lt;br /&gt;
{{LSL DefineRow||[[llHTTPResponse]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetHTTPHeader]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[LSL http server]]}}&lt;br /&gt;
|notes&lt;br /&gt;
|deepnotes=&lt;br /&gt;
|history=&lt;br /&gt;
*{{SVN|1836|rev=112899 |trunk=*|anchor=file22|ver=|ser=}}&lt;br /&gt;
|cat1=HTTP&lt;br /&gt;
|cat2=HTTP/Server&lt;br /&gt;
|cat3&lt;br /&gt;
|cat4&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlRequestURL&amp;diff=474752</id>
		<title>LlRequestURL</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlRequestURL&amp;diff=474752"/>
		<updated>2009-08-29T15:50:17Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|func_id=345|func_sleep=0.0|func_energy=10.0|mode&lt;br /&gt;
|func=llRequestURL|return_type=key&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc=Requests one HTTP:// url for use by this object. The [[http_request]] event is triggered with the results.&lt;br /&gt;
|return_text=that is the handle used for identifying the request in the [[http_request]] event.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=*When a region is (re)started all [[http_request|HTTP server]] URLs are automatically released and invalidated.&lt;br /&gt;
**Use [[CHANGED_REGION_START]] to detect this so new URL can be requested.&lt;br /&gt;
*An old URL MUST be released first by using [[llReleaseURL]] or it will be still active and you are losing free URLs.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions=&lt;br /&gt;
{{LSL DefineRow||[[llRequestSecureURL]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetFreeURLs]]}}&lt;br /&gt;
{{LSL DefineRow||[[llReleaseURL]]}}&lt;br /&gt;
{{LSL DefineRow||[[llHTTPResponse]]}}&lt;br /&gt;
{{LSL DefineRow||[[llGetHTTPHeader]]}}&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_events&lt;br /&gt;
|also_articles=&lt;br /&gt;
{{LSL DefineRow||[[LSL http server]]}}&lt;br /&gt;
|notes&lt;br /&gt;
|deepnotes=&lt;br /&gt;
|history=&lt;br /&gt;
*{{SVN|1836|rev=112899 |trunk=*|anchor=file22|ver=|ser=}}&lt;br /&gt;
|cat1=HTTP&lt;br /&gt;
|cat2=HTTP/Server&lt;br /&gt;
|cat3&lt;br /&gt;
|cat4&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=466373</id>
		<title>LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=466373"/>
		<updated>2009-08-19T18:54:39Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: /* Simple script for sending data to an LSL via PHP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}&lt;br /&gt;
=== Utility Script ===&lt;br /&gt;
A script intended as a &#039;fill in the blank&#039; exercise for very, very simple HTTP servers is here: [[LSL_http_server/examples/utility_script | Utility Script]]&lt;br /&gt;
=== Hello World! ===&lt;br /&gt;
Classic example, the smallest http_request script possible.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
A slightly more robust version:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visitor List ===&lt;br /&gt;
A list of residents within sensor range of the server.&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
* This includes a method for handling multiple requests while waiting for asynchronous data requests to come back.&lt;br /&gt;
&amp;lt;lsl&amp;gt;integer scanning = FALSE;&lt;br /&gt;
&lt;br /&gt;
list requests;&lt;br /&gt;
&lt;br /&gt;
send_response(string body)&lt;br /&gt;
{&lt;br /&gt;
    integer j;&lt;br /&gt;
    for (j = 0; j &amp;lt; llGetListLength(requests); ++j)&lt;br /&gt;
    {&lt;br /&gt;
        llHTTPResponse(llList2Key(requests,j), 200, body);&lt;br /&gt;
    }&lt;br /&gt;
    requests = [];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            if (!scanning)&lt;br /&gt;
            {&lt;br /&gt;
                llSensor(&amp;quot;&amp;quot;,NULL_KEY,AGENT,96,PI);&lt;br /&gt;
                scanning = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            requests += [id];&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported method.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    no_sensor()&lt;br /&gt;
    {&lt;br /&gt;
        send_response(&amp;quot;There is no one here.&amp;quot;);&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    sensor(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        string output;&lt;br /&gt;
        if (n &amp;lt; 16) output = &amp;quot;There are &amp;quot; + (string)n + &amp;quot; avatars nearby:&amp;quot;;&lt;br /&gt;
        else output = &amp;quot;There are at least 16 avatars nearby:&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i = 0;i&amp;lt;n;++i)&lt;br /&gt;
        {&lt;br /&gt;
            output += &amp;quot;\n\t&amp;quot; + llDetectedName(i);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        send_response(output);&lt;br /&gt;
&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Url Persistence / Visitor Counter ===&lt;br /&gt;
A more complete &#039;hello world&#039;, always has an url and keeps a visitor counter.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
integer hits;&lt;br /&gt;
&lt;br /&gt;
setup()&lt;br /&gt;
{&lt;br /&gt;
    llSetObjectName(&amp;quot;HTTP Server&amp;quot;);&lt;br /&gt;
    url = &amp;quot;&amp;quot;;&lt;br /&gt;
    llRequestURL();&lt;br /&gt;
    hits = (integer)llGetObjectDesc();&lt;br /&gt;
    llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { setup(); }&lt;br /&gt;
    on_rez(integer n) { setup(); }&lt;br /&gt;
    &lt;br /&gt;
    changed(integer c)&lt;br /&gt;
    {&lt;br /&gt;
        if (c &amp;amp; (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )&lt;br /&gt;
        {&lt;br /&gt;
            setup();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    touch_start(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;My url is: &amp;quot; + url);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            url = body;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            ++hits;&lt;br /&gt;
            llSetObjectDesc((string)hits);&lt;br /&gt;
            llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello!  You are visitor &amp;quot; + (string)hits + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Method unsupported&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid.  ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL();     // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
     http_request(key id, string method, string body) {&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information from the outside: &amp;quot; + body);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Thank you for calling. All of our operators are busy.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the PERL script to contact the prim on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
    # First get the arguments.&lt;br /&gt;
    my $url = shift;&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    # Create the objects to be used to send out the HTTP request&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);&lt;br /&gt;
&lt;br /&gt;
    # Set the encoding method and specify the information to be sent.&lt;br /&gt;
    $request-&amp;gt;content_type(&#039;application/x-www-form-urlencoded&#039;);&lt;br /&gt;
    $request-&amp;gt;content(uri_escape($information));&lt;br /&gt;
&lt;br /&gt;
    # Send the request.&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);&lt;br /&gt;
&lt;br /&gt;
    # Return the information sent back&lt;br /&gt;
    return($response-&amp;gt;content);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,&#039;id=244195d6-c9b7-4fd6-9229-c3a8b2e60e81&amp;amp;name=M Linden&#039;);&lt;br /&gt;
&lt;br /&gt;
print $info,&amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the Python code that does the same thing as the PERL code above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    # Set the parameters to be sent.&lt;br /&gt;
    encodedParams =  urllib.urlencode(parameters);&lt;br /&gt;
&lt;br /&gt;
    # Post the data.&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);&lt;br /&gt;
&lt;br /&gt;
    # return the result.&lt;br /&gt;
    return(net.read());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;}&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST With Argument Parsing ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. In this example the scripts are adapted to handle the parsing of the arguments that are passed. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid. ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
// ###############################################&lt;br /&gt;
// Routine to parse a string sent through the &lt;br /&gt;
// http server via post.&lt;br /&gt;
//       parsePostData(theMessage)&lt;br /&gt;
// Returns a strided list with stride length 2.&lt;br /&gt;
// Each set has the key and then its value.&lt;br /&gt;
list parsePostData(string message) {&lt;br /&gt;
    list postData = [];         // The list with the data that was passed in.&lt;br /&gt;
    list parsedMessage = llParseString2List(message,[&amp;quot;&amp;amp;&amp;quot;],[]);    // The key/value pairs parsed into one list.&lt;br /&gt;
    integer len = ~llGetListLength(parsedMessage);&lt;br /&gt;
&lt;br /&gt;
    while(++len) {          &lt;br /&gt;
        string currentField = llList2String(parsedMessage, len); // Current key/value pair as a string.&lt;br /&gt;
&lt;br /&gt;
        integer split = llSubStringIndex(currentField,&amp;quot;=&amp;quot;);     // Find the &amp;quot;=&amp;quot; sign&lt;br /&gt;
        if(split == -1) { // There is only one field in this part of the message.&lt;br /&gt;
            postData += [llUnescapeURL(currentField),&amp;quot;&amp;quot;];  &lt;br /&gt;
        } else {&lt;br /&gt;
            postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    // Return the strided list.&lt;br /&gt;
    return postData ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL(); // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    http_request(key id, string method, string body) {&lt;br /&gt;
         list incomingMessage;&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + &lt;br /&gt;
                       body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information form the outside: &amp;quot; + body);&lt;br /&gt;
            incomingMessage = parsePostData(body);&lt;br /&gt;
            llOwnerSay(llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;You passed the following:\n&amp;quot; + &lt;br /&gt;
                           llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has&lt;br /&gt;
            // not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding PERL script for contacting the LSL script on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my $url = shift;                   # First get the arguments.&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;                # Create the object&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);   # used to send the&lt;br /&gt;
                                                      # HTTP request&lt;br /&gt;
&lt;br /&gt;
    $request-&amp;gt;content_type                            # Set the&lt;br /&gt;
	(&#039;application/x-www-form-urlencoded&#039;);        # encoding type.&lt;br /&gt;
    $request-&amp;gt;content(hash2URI($information));        # Set the content to&lt;br /&gt;
                                                      # send.&lt;br /&gt;
&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);       # Send the request.&lt;br /&gt;
    return($response-&amp;gt;content);                       # Return the&lt;br /&gt;
						      # information that&lt;br /&gt;
						      # was sent back&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #########################################################################&lt;br /&gt;
# Convert a hash to a url encoded string &lt;br /&gt;
#      hash2URI(\%hash)&lt;br /&gt;
sub hash2URI {&lt;br /&gt;
    my $theHash = shift;            # Get the arguments passed.&lt;br /&gt;
    my $encodedString = &#039;&#039;;         # The encoded string to return.&lt;br /&gt;
    my $lupe;                       # a loop variable.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    foreach $lupe (keys %{$theHash}) {                # &lt;br /&gt;
	$encodedString .= uri_escape($lupe) . &#039;=&#039; .   # Add each item in the&lt;br /&gt;
	    uri_escape($$theHash{$lupe}) . &#039;&amp;amp;&#039;;       # hash to the encoded string.&lt;br /&gt;
    }&lt;br /&gt;
    $encodedString =~ s/&amp;amp;$//;                         # Remove the trailing &amp;quot;&amp;amp;&amp;quot;&lt;br /&gt;
    return($encodedString);                           # Send the encoded string.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,{&#039;action&#039; =&amp;gt; &#039;send message&#039;,&lt;br /&gt;
	   &#039;value&#039;=&amp;gt; &#039;Hi there chief!&#039;,&lt;br /&gt;
	   &#039;id&#039;=&amp;gt;&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
	   &#039;name&#039;=&amp;gt;&#039;M Linden&#039;});&lt;br /&gt;
&lt;br /&gt;
print($info,&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding Python script. It does the same thing as the PERL script above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    &lt;br /&gt;
#    encodedParams =  urllib.urlencode(parameters);  # encode the parameters&lt;br /&gt;
    encodedParams  = dictionary2URI(parameters);    # encode the parameters&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);        # Post the data.&lt;br /&gt;
    return(net.read());                             # return the result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ################################################&lt;br /&gt;
# Routine to encode a dictionary without using &lt;br /&gt;
# &amp;quot;+&amp;quot; for spaces.&lt;br /&gt;
#       dictionary2URI(theDictionary)&lt;br /&gt;
def dictionary2URI(theDictionary) : &lt;br /&gt;
&lt;br /&gt;
    encoded = &#039;&#039;;           # Initialize the string to return&lt;br /&gt;
    for key, value in theDictionary.iteritems():&lt;br /&gt;
        # Encode each item in the dictionary.&lt;br /&gt;
        encoded += urllib.quote(key)+&amp;quot;=&amp;quot;+urllib.quote(value)+&amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    remove = re.compile(&#039;&amp;amp;$&#039;)             # Remove the trailing ampersand.&lt;br /&gt;
    encoded = remove.sub(&#039;&#039;,encoded);&lt;br /&gt;
&lt;br /&gt;
    return(encoded);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;,&lt;br /&gt;
                  &#039;action&#039;:&#039;send message&#039;,&lt;br /&gt;
                  &#039;value&#039;:&#039;Hey there, hi there, ho there!&#039;};&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;lsl&amp;gt;&amp;lt;/lsl&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple script for sending data to an LSL via PHP ===&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  llRequestURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key id, string method, string body)&lt;br /&gt;
 {&lt;br /&gt;
  if ((method == URL_REQUEST_GRANTED))&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (method == &amp;quot;POST&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
   llHTTPResponse(id, 200, body + &amp;quot; there !&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the PHP.&lt;br /&gt;
It sends &amp;quot;Hello&amp;quot; to the LSL Script which adds &amp;quot; there !&amp;quot; and returns it, so the php will return &amp;quot;Hello there !&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;php&amp;gt;&lt;br /&gt;
&amp;lt;?&lt;br /&gt;
$Data = CallLSLScript(&amp;quot;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&amp;quot;, &amp;quot;Hello&amp;quot;);&lt;br /&gt;
die($Data);&lt;br /&gt;
&lt;br /&gt;
//Function by Simba Fuhr&lt;br /&gt;
//Use under the GPL License&lt;br /&gt;
function CallLSLScript($URL, $Data, $Timeout = 10)&lt;br /&gt;
{&lt;br /&gt;
 //Parse the URL into Server, Path and Port&lt;br /&gt;
 $Host = str_ireplace(&amp;quot;http://&amp;quot;, &amp;quot;&amp;quot;, $URL);&lt;br /&gt;
 $Path = explode(&amp;quot;/&amp;quot;, $Host, 2);&lt;br /&gt;
 $Host = $Path[0];&lt;br /&gt;
 $Path = $Path[1];&lt;br /&gt;
 $PrtSplit = explode(&amp;quot;:&amp;quot;, $Host);&lt;br /&gt;
 $Host = $PrtSplit[0];&lt;br /&gt;
 $Port = $PrtSplit[1];&lt;br /&gt;
 &lt;br /&gt;
 //Open Connection&lt;br /&gt;
 $Socket = fsockopen($Host, $Port, $Dummy1, $Dummy2, $Timeout);&lt;br /&gt;
 if ($Socket)&lt;br /&gt;
 {&lt;br /&gt;
  //Send Header and Data&lt;br /&gt;
  fputs($Socket, &amp;quot;POST /$Path HTTP/1.1\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Host: $Host\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Content-type: application/x-www-form-urlencoded\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Content-length: &amp;quot;.strlen($Data).&amp;quot;\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Connection: close\r\n\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, $Data);&lt;br /&gt;
   &lt;br /&gt;
  //Receive Data&lt;br /&gt;
  while(!feof($Socket))&lt;br /&gt;
   {$res .= fgets($Socket, 128);}&lt;br /&gt;
  fclose($Socket);&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 //ParseData and return it&lt;br /&gt;
 $res = explode(&amp;quot;\r\n\r\n&amp;quot;, $res);&lt;br /&gt;
 return $res[1];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Kelly&#039;s Stupid Web Status Updater ===&lt;br /&gt;
Is actually on its own page: [[LSL_http_server/examples/kellys_stupid_web_status_updater | Kelly&#039;s Stupid Web Status Updater]]&amp;lt;br&amp;gt;&lt;br /&gt;
Kurai&#039;s mod from Kelly&#039;s stupid thing: [[LSL_http_server/examples/kurais_stupid_web_status_updater| Kurai&#039;s Stupid Web Status Updater Mod]]&lt;br /&gt;
{{LSLC|HTTP}}{{LSLC|Examples}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=466363</id>
		<title>LSL HTTP server/examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_HTTP_server/examples&amp;diff=466363"/>
		<updated>2009-08-19T18:53:36Z</updated>

		<summary type="html">&lt;p&gt;Simba Fuhr: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}&lt;br /&gt;
=== Utility Script ===&lt;br /&gt;
A script intended as a &#039;fill in the blank&#039; exercise for very, very simple HTTP servers is here: [[LSL_http_server/examples/utility_script | Utility Script]]&lt;br /&gt;
=== Hello World! ===&lt;br /&gt;
Classic example, the smallest http_request script possible.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
A slightly more robust version:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visitor List ===&lt;br /&gt;
A list of residents within sensor range of the server.&lt;br /&gt;
&amp;lt;br&amp;gt;Notes:&lt;br /&gt;
* This includes a method for handling multiple requests while waiting for asynchronous data requests to come back.&lt;br /&gt;
&amp;lt;lsl&amp;gt;integer scanning = FALSE;&lt;br /&gt;
&lt;br /&gt;
list requests;&lt;br /&gt;
&lt;br /&gt;
send_response(string body)&lt;br /&gt;
{&lt;br /&gt;
    integer j;&lt;br /&gt;
    for (j = 0; j &amp;lt; llGetListLength(requests); ++j)&lt;br /&gt;
    {&lt;br /&gt;
        llHTTPResponse(llList2Key(requests,j), 200, body);&lt;br /&gt;
    }&lt;br /&gt;
    requests = [];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llRequestURL();&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0,&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            if (!scanning)&lt;br /&gt;
            {&lt;br /&gt;
                llSensor(&amp;quot;&amp;quot;,NULL_KEY,AGENT,96,PI);&lt;br /&gt;
                scanning = TRUE;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            requests += [id];&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported method.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    no_sensor()&lt;br /&gt;
    {&lt;br /&gt;
        send_response(&amp;quot;There is no one here.&amp;quot;);&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    sensor(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        string output;&lt;br /&gt;
        if (n &amp;lt; 16) output = &amp;quot;There are &amp;quot; + (string)n + &amp;quot; avatars nearby:&amp;quot;;&lt;br /&gt;
        else output = &amp;quot;There are at least 16 avatars nearby:&amp;quot;;&lt;br /&gt;
        &lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i = 0;i&amp;lt;n;++i)&lt;br /&gt;
        {&lt;br /&gt;
            output += &amp;quot;\n\t&amp;quot; + llDetectedName(i);&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        send_response(output);&lt;br /&gt;
&lt;br /&gt;
        scanning = FALSE;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Url Persistence / Visitor Counter ===&lt;br /&gt;
A more complete &#039;hello world&#039;, always has an url and keeps a visitor counter.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
string url;&lt;br /&gt;
integer hits;&lt;br /&gt;
&lt;br /&gt;
setup()&lt;br /&gt;
{&lt;br /&gt;
    llSetObjectName(&amp;quot;HTTP Server&amp;quot;);&lt;br /&gt;
    url = &amp;quot;&amp;quot;;&lt;br /&gt;
    llRequestURL();&lt;br /&gt;
    hits = (integer)llGetObjectDesc();&lt;br /&gt;
    llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry() { setup(); }&lt;br /&gt;
    on_rez(integer n) { setup(); }&lt;br /&gt;
    &lt;br /&gt;
    changed(integer c)&lt;br /&gt;
    {&lt;br /&gt;
        if (c &amp;amp; (CHANGED_REGION | CHANGED_REGION_START | CHANGED_TELEPORT) )&lt;br /&gt;
        {&lt;br /&gt;
            setup();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    touch_start(integer n)&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0,&amp;quot;My url is: &amp;quot; + url);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    http_request(key id, string method, string body)&lt;br /&gt;
    {&lt;br /&gt;
        if (method == URL_REQUEST_GRANTED)&lt;br /&gt;
        {&lt;br /&gt;
            url = body;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == URL_REQUEST_DENIED)&lt;br /&gt;
        {&lt;br /&gt;
            llSay(0, &amp;quot;Something went wrong, no url. &amp;quot; + body);&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;GET&amp;quot;)&lt;br /&gt;
        {&lt;br /&gt;
            ++hits;&lt;br /&gt;
            llSetObjectDesc((string)hits);&lt;br /&gt;
            llSetText((string)hits + &amp;quot; visitors.&amp;quot;,&amp;lt;1,1,0&amp;gt;,1);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Hello!  You are visitor &amp;quot; + (string)hits + &amp;quot;.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Method unsupported&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid.  ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL();     // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
     http_request(key id, string method, string body) {&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information from the outside: &amp;quot; + body);&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;Thank you for calling. All of our operators are busy.&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the PERL script to contact the prim on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
    # First get the arguments.&lt;br /&gt;
    my $url = shift;&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    # Create the objects to be used to send out the HTTP request&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);&lt;br /&gt;
&lt;br /&gt;
    # Set the encoding method and specify the information to be sent.&lt;br /&gt;
    $request-&amp;gt;content_type(&#039;application/x-www-form-urlencoded&#039;);&lt;br /&gt;
    $request-&amp;gt;content(uri_escape($information));&lt;br /&gt;
&lt;br /&gt;
    # Send the request.&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);&lt;br /&gt;
&lt;br /&gt;
    # Return the information sent back&lt;br /&gt;
    return($response-&amp;gt;content);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,&#039;id=244195d6-c9b7-4fd6-9229-c3a8b2e60e81&amp;amp;name=M Linden&#039;);&lt;br /&gt;
&lt;br /&gt;
print $info,&amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the Python code that does the same thing as the PERL code above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    # Set the parameters to be sent.&lt;br /&gt;
    encodedParams =  urllib.urlencode(parameters);&lt;br /&gt;
&lt;br /&gt;
    # Post the data.&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);&lt;br /&gt;
&lt;br /&gt;
    # return the result.&lt;br /&gt;
    return(net.read());&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/d57a7c8b-3ace-3186-730a-f22fde870d48&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;}&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perl/Python Examples Using POST With Argument Parsing ===&lt;br /&gt;
Here are a set of scripts to provide another example using POST. In this example the scripts are adapted to handle the parsing of the arguments that are passed. The first script is the LSL code to receive the information on the grid. The second script is a PERL script that is used on the outside server to contact the code on the grid. The third script is a Python script that is also used on the outside server to contact the code on the grid. ([[User:Grandma Bates|Grandma Bates]] 12:42, 27 May 2009 (UTC))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key requestURL;&lt;br /&gt;
&lt;br /&gt;
// ###############################################&lt;br /&gt;
// Routine to parse a string sent through the &lt;br /&gt;
// http server via post.&lt;br /&gt;
//       parsePostData(theMessage)&lt;br /&gt;
// Returns a strided list with stride length 2.&lt;br /&gt;
// Each set has the key and then its value.&lt;br /&gt;
list parsePostData(string message) {&lt;br /&gt;
    list postData = [];         // The list with the data that was passed in.&lt;br /&gt;
    list parsedMessage = llParseString2List(message,[&amp;quot;&amp;amp;&amp;quot;],[]);    // The key/value pairs parsed into one list.&lt;br /&gt;
    integer len = ~llGetListLength(parsedMessage);&lt;br /&gt;
&lt;br /&gt;
    while(++len) {          &lt;br /&gt;
        string currentField = llList2String(parsedMessage, len); // Current key/value pair as a string.&lt;br /&gt;
&lt;br /&gt;
        integer split = llSubStringIndex(currentField,&amp;quot;=&amp;quot;);     // Find the &amp;quot;=&amp;quot; sign&lt;br /&gt;
        if(split == -1) { // There is only one field in this part of the message.&lt;br /&gt;
            postData += [llUnescapeURL(currentField),&amp;quot;&amp;quot;];  &lt;br /&gt;
        } else {&lt;br /&gt;
            postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    // Return the strided list.&lt;br /&gt;
    return postData ;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
&lt;br /&gt;
    state_entry() {&lt;br /&gt;
        requestURL = llRequestURL(); // Request that an URL be assigned to me.&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    http_request(key id, string method, string body) {&lt;br /&gt;
         list incomingMessage;&lt;br /&gt;
        &lt;br /&gt;
        if ((method == URL_REQUEST_GRANTED) &amp;amp;&amp;amp; (id == requestURL) ){&lt;br /&gt;
            // An URL has been assigned to me.&lt;br /&gt;
            llOwnerSay(&amp;quot;Obtained URL: &amp;quot; + body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if ((method == URL_REQUEST_DENIED) &amp;amp;&amp;amp; (id == requestURL)) {&lt;br /&gt;
            // I could not obtain a URL&lt;br /&gt;
            llOwnerSay(&amp;quot;There was a problem, and an URL was not assigned: &amp;quot; + &lt;br /&gt;
                       body);&lt;br /&gt;
            requestURL = NULL_KEY;&lt;br /&gt;
        }&lt;br /&gt;
        else if (method == &amp;quot;POST&amp;quot;) {&lt;br /&gt;
            // An incoming message was received.&lt;br /&gt;
            llOwnerSay(&amp;quot;Received information form the outside: &amp;quot; + body);&lt;br /&gt;
            incomingMessage = parsePostData(body);&lt;br /&gt;
            llOwnerSay(llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            llHTTPResponse(id,200,&amp;quot;You passed the following:\n&amp;quot; + &lt;br /&gt;
                           llDumpList2String(incomingMessage,&amp;quot;\n&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
            // An incoming message has come in using a method that has&lt;br /&gt;
            // not been anticipated.&lt;br /&gt;
            llHTTPResponse(id,405,&amp;quot;Unsupported Method&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding PERL script for contacting the LSL script on the grid.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
# Routine to contact a script on the SL Grid using http server&lt;br /&gt;
&lt;br /&gt;
use LWP;&lt;br /&gt;
require HTTP::Request;&lt;br /&gt;
use URI::Escape;&lt;br /&gt;
use strict;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation($url,$information)&lt;br /&gt;
#&lt;br /&gt;
sub submitInformation{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    my $url = shift;                   # First get the arguments.&lt;br /&gt;
    my $information = shift;&lt;br /&gt;
&lt;br /&gt;
    my $browser = LWP::UserAgent-&amp;gt;new;                # Create the object&lt;br /&gt;
    my $request = HTTP::Request-&amp;gt;new(POST =&amp;gt; $url);   # used to send the&lt;br /&gt;
                                                      # HTTP request&lt;br /&gt;
&lt;br /&gt;
    $request-&amp;gt;content_type                            # Set the&lt;br /&gt;
	(&#039;application/x-www-form-urlencoded&#039;);        # encoding type.&lt;br /&gt;
    $request-&amp;gt;content(hash2URI($information));        # Set the content to&lt;br /&gt;
                                                      # send.&lt;br /&gt;
&lt;br /&gt;
    my $response = $browser-&amp;gt;request($request);       # Send the request.&lt;br /&gt;
    return($response-&amp;gt;content);                       # Return the&lt;br /&gt;
						      # information that&lt;br /&gt;
						      # was sent back&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# #########################################################################&lt;br /&gt;
# Convert a hash to a url encoded string &lt;br /&gt;
#      hash2URI(\%hash)&lt;br /&gt;
sub hash2URI {&lt;br /&gt;
    my $theHash = shift;            # Get the arguments passed.&lt;br /&gt;
    my $encodedString = &#039;&#039;;         # The encoded string to return.&lt;br /&gt;
    my $lupe;                       # a loop variable.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    foreach $lupe (keys %{$theHash}) {                # &lt;br /&gt;
	$encodedString .= uri_escape($lupe) . &#039;=&#039; .   # Add each item in the&lt;br /&gt;
	    uri_escape($$theHash{$lupe}) . &#039;&amp;amp;&#039;;       # hash to the encoded string.&lt;br /&gt;
    }&lt;br /&gt;
    $encodedString =~ s/&amp;amp;$//;                         # Remove the trailing &amp;quot;&amp;amp;&amp;quot;&lt;br /&gt;
    return($encodedString);                           # Send the encoded string.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Set the URL manually....&lt;br /&gt;
my $url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
my $info = submitInformation&lt;br /&gt;
    ($url,{&#039;action&#039; =&amp;gt; &#039;send message&#039;,&lt;br /&gt;
	   &#039;value&#039;=&amp;gt; &#039;Hi there chief!&#039;,&lt;br /&gt;
	   &#039;id&#039;=&amp;gt;&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
	   &#039;name&#039;=&amp;gt;&#039;M Linden&#039;});&lt;br /&gt;
&lt;br /&gt;
print($info,&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the coresponding Python script. It does the same thing as the PERL script above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
import urllib&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
# #################################################&lt;br /&gt;
# Routine to send the information to the prim&lt;br /&gt;
#     submitInformation(url,information)&lt;br /&gt;
#&lt;br /&gt;
def submitInformation(url,parameters) :&lt;br /&gt;
    &lt;br /&gt;
#    encodedParams =  urllib.urlencode(parameters);  # encode the parameters&lt;br /&gt;
    encodedParams  = dictionary2URI(parameters);    # encode the parameters&lt;br /&gt;
    net = urllib.urlopen(url,encodedParams);        # Post the data.&lt;br /&gt;
    return(net.read());                             # return the result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# ################################################&lt;br /&gt;
# Routine to encode a dictionary without using &lt;br /&gt;
# &amp;quot;+&amp;quot; for spaces.&lt;br /&gt;
#       dictionary2URI(theDictionary)&lt;br /&gt;
def dictionary2URI(theDictionary) : &lt;br /&gt;
&lt;br /&gt;
    encoded = &#039;&#039;;           # Initialize the string to return&lt;br /&gt;
    for key, value in theDictionary.iteritems():&lt;br /&gt;
        # Encode each item in the dictionary.&lt;br /&gt;
        encoded += urllib.quote(key)+&amp;quot;=&amp;quot;+urllib.quote(value)+&amp;quot;&amp;amp;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    remove = re.compile(&#039;&amp;amp;$&#039;)             # Remove the trailing ampersand.&lt;br /&gt;
    encoded = remove.sub(&#039;&#039;,encoded);&lt;br /&gt;
&lt;br /&gt;
    return(encoded);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # Set the URL manually&lt;br /&gt;
    url = &#039;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Define the parameters&lt;br /&gt;
    parameters = {&#039;id&#039;:&#039;244195d6-c9b7-4fd6-9229-c3a8b2e60e81&#039;,&lt;br /&gt;
                  &#039;name&#039;:&#039;M Linden&#039;,&lt;br /&gt;
                  &#039;action&#039;:&#039;send message&#039;,&lt;br /&gt;
                  &#039;value&#039;:&#039;Hey there, hi there, ho there!&#039;};&lt;br /&gt;
&lt;br /&gt;
    # Pass the information along to the prim&lt;br /&gt;
    info = submitInformation(url,parameters);&lt;br /&gt;
    print(info);&lt;br /&gt;
&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;lsl&amp;gt;&amp;lt;/lsl&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simple script for sending data to an LSL via PHP ===&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
 state_entry()&lt;br /&gt;
 {&lt;br /&gt;
  llRequestURL();&lt;br /&gt;
 }&lt;br /&gt;
 http_request(key id, string method, string body)&lt;br /&gt;
 {&lt;br /&gt;
  if ((method == URL_REQUEST_GRANTED))&lt;br /&gt;
  {&lt;br /&gt;
   llOwnerSay(&amp;quot;URL: &amp;quot; + body);&lt;br /&gt;
  }&lt;br /&gt;
  else if (method == &amp;quot;POST&amp;quot;)&lt;br /&gt;
  {&lt;br /&gt;
   llHTTPResponse(id, 200, body + &amp;quot; there !&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the PHP.&lt;br /&gt;
It sends &amp;quot;Hello&amp;quot; to the LSL Script which adds &amp;quot; there !&amp;quot; and returns it, so the php will return &amp;quot;Hello there !&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;php&amp;gt;&lt;br /&gt;
&amp;lt;?&lt;br /&gt;
$Data = CallLSLScript(&amp;quot;http://sim3015.aditi.lindenlab.com:12046/cap/5a1b89cd-e681-8110-7245-fb98969f32a0&amp;quot;, &amp;quot;Hello&amp;quot;);&lt;br /&gt;
die();&lt;br /&gt;
&lt;br /&gt;
//Function by Simba Fuhr&lt;br /&gt;
//Use under the GPL License&lt;br /&gt;
function CallLSLScript($URL, $Data, $Timeout = 10)&lt;br /&gt;
{&lt;br /&gt;
 //Parse the URL into Server, Path and Port&lt;br /&gt;
 $Host = str_ireplace(&amp;quot;http://&amp;quot;, &amp;quot;&amp;quot;, $URL);&lt;br /&gt;
 $Path = explode(&amp;quot;/&amp;quot;, $Host, 2);&lt;br /&gt;
 $Host = $Path[0];&lt;br /&gt;
 $Path = $Path[1];&lt;br /&gt;
 $PrtSplit = explode(&amp;quot;:&amp;quot;, $Host);&lt;br /&gt;
 $Host = $PrtSplit[0];&lt;br /&gt;
 $Port = $PrtSplit[1];&lt;br /&gt;
 &lt;br /&gt;
 //Open Connection&lt;br /&gt;
 $Socket = fsockopen($Host, $Port, $Dummy1, $Dummy2, $Timeout);&lt;br /&gt;
 if ($Socket)&lt;br /&gt;
 {&lt;br /&gt;
  //Send Header and Data&lt;br /&gt;
  fputs($Socket, &amp;quot;POST /$Path HTTP/1.1\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Host: $Host\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Content-type: application/x-www-form-urlencoded\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;User-Agent: Opera/9.01 (Windows NT 5.1; U; en)\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Accept-Language: de-DE,de;q=0.9,en;q=0.8\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Content-length: &amp;quot;.strlen($Data).&amp;quot;\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, &amp;quot;Connection: close\r\n\r\n&amp;quot;);&lt;br /&gt;
  fputs($Socket, $Data);&lt;br /&gt;
   &lt;br /&gt;
  //Receive Data&lt;br /&gt;
  while(!feof($Socket))&lt;br /&gt;
   {$res .= fgets($Socket, 128);}&lt;br /&gt;
  fclose($Socket);&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 //ParseData and return it&lt;br /&gt;
 $res = explode(&amp;quot;\r\n\r\n&amp;quot;, $res);&lt;br /&gt;
 return $res[1];&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Kelly&#039;s Stupid Web Status Updater ===&lt;br /&gt;
Is actually on its own page: [[LSL_http_server/examples/kellys_stupid_web_status_updater | Kelly&#039;s Stupid Web Status Updater]]&amp;lt;br&amp;gt;&lt;br /&gt;
Kurai&#039;s mod from Kelly&#039;s stupid thing: [[LSL_http_server/examples/kurais_stupid_web_status_updater| Kurai&#039;s Stupid Web Status Updater Mod]]&lt;br /&gt;
{{LSLC|HTTP}}{{LSLC|Examples}}&lt;/div&gt;</summary>
		<author><name>Simba Fuhr</name></author>
	</entry>
</feed>