Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

PHP sockets

Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-04-2009 17:19
From: Zeta Eizenstark
When I tried it like this:
http_request_id = llHTTPRequest("url", [HTTP_METHOD,"POST"], "toucher=" + x);

it didn't work, it said in the php code that toucher was undefined but like this:
http_request_id= llHTTPRequest( "url", [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],"toucher=" + x);

it worked, so, do I have to have the HTTP_MIMETYPE for it work?


Yes. Best to do it that way IMO. If you want a large piece of arbitrary data, just name the parameter "data" or something. Be careful because llEscapeURL() can only do chunks of something like 255 characters at a time. So you might need to pay a little attention to how you do the encoding.

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llEscapeURL
Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
03-15-2009 18:00
is this not allowed:
SL:
requestid= llHTTPRequest( "url", [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"] , "wind=" + wind + "temp=" + temp);

PHP:
$SLwind = $_POST['wind'];
$SLtemp = $_POST['temp'];

When I use the request it gives me and error msg in the php code that the temp variable is not found. How would I send two variables in one request and have the php code recieve them.
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
03-15-2009 18:06
From: Zeta Eizenstark
is this not allowed:
SL:
requestid= llHTTPRequest( "url", [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"] , "wind=" + wind + "temp=" + temp);

PHP:
$SLwind = $_POST['wind'];
$SLtemp = $_POST['temp'];

When I use the request it gives me and error msg in the php code that the temp variable is not found. How would I send two variables in one request and have the php code recieve them.


You need separate the variables in your httrequest with "?" and "&" simbols .
your code:

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

fixed code:

requestid= llHTTPRequest( url, [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"] , "?wind=" + wind + "&temp=" + temp);

the "?" character indicates the php files the nexts variables and the "&" concatenate the next variables.
look at your address in your browser now as example..

http://forums.secondlife.com/newreply.php?do=newreply&p=2356825

do you see the "?" and "&" ?

and.. the url its already an declared string?
the temp and wind variables must be an string too if not you need to convert it with (string) before every variable ex:

?wind=" + (string)wind + "&temp=" +(string) temp

string url="some web adress";
;)
_____________________


RAW terrain files - terraform your SIM!!
http://www.wishland.info/
PD:the wiki its your friend ;)
http://wiki.secondlife.com/wiki/LSL_Portal
Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
03-15-2009 18:37
huh...I see them but when i but the "?" before wind it was giving me this error:
Object: <br />
<b>Notice</b>: Undefined index: wind in <b>D:\secondlife\hi.php</b> on line <b>2</b><br />
2,0PHP Notice: Undefined index: wind in D:\secondlife\hi.php on line 2

but after I changed the "?" before wind to "&" it worked. Why?

just in case heres my full php code:
CODE

<?php
$SLwind = $_POST['wind'];
$SLtemp = $_POST['temp'];
$SLtemp = $SLtemp * 2;
$SLwind = $SLwind * 3;
print($SLtemp.",".$SLwind);
?>
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
03-15-2009 19:23
try this i test it ;

CODE


string url="http://www.yourdomain.com/test_wind.php";
key request_id;
vector wind;
integer temp;// i dont know what data its...
default
{
state_entry()
{

}

touch_start(integer total_number)
{
wind=llWind(ZERO_VECTOR);
temp=123;//i asume its numerical

request_id= llHTTPRequest( url, [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],"?wind"+(string)wind+"&temp="+(string)temp);
}

http_response(key request_id2, integer status, list metadata, string body)

{

llOwnerSay(body);
}


}


CODE

<?
$SLwind =str_replace('$', '\$',$_POST['wind']);
$SLtemp=str_replace('$', '\$',$_POST['temp']);
$SLtemp = $SLtemp * 2;
$SLwind = $SLwind * 3;

echo "temp is: ".$SLtemp." : "."wind is: ".$SLwind;






?>


_____________________


RAW terrain files - terraform your SIM!!
http://www.wishland.info/
PD:the wiki its your friend ;)
http://wiki.secondlife.com/wiki/LSL_Portal
Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
03-21-2009 17:39
Thanks to everone that helped. It was a long road but I learned a lot and I'm a better scripter for it.
I was wondering it would be possible to use the httprequest to get a weather map from a weather site and set it as a texture and have a button next to it to refresh it. I have looked around and the two most interesting were:
/54/83/256334/1.html
and
/54/71/210450/1.html
I'm not to sure about the first one but the second one seems to just get information. All I want is the weather map set as a texture. Is this possible?
Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
03-23-2009 11:35
:}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-23-2009 12:12
You cannot download a texture from outside SL using a script. However, you could probably set the parcel media URL to point at the weather map if you have suitable access to the parcel (the parcel owner must own the object with the script, or if the parcel is deeded to a group the object must be deeded to the same group).

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llParcelMediaCommandList
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
03-23-2009 16:59
From: Zeta Eizenstark
Where can i get the informaition for this, my group wants to make a simulation of global warming and I heard that we can use this to get information from another place.


Were you wanting to simulate global warming in SL because it doesn't exist in RL?
_____________________
My tutes
http://www.youtube.com/johanlaurasia
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-23-2009 17:13
You could also look at using libsl's grid proxy to inject the texture temporarily into the sim and then use it. Not sure how long it stays in the simulator, I've had some stick around a couple of hours while I was online with no problems. No upload fees going that route.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-23-2009 17:14
From: Johan Laurasia
Were you wanting to simulate global warming in SL because it doesn't exist in RL?

Cheney's alt?????? :p
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
03-27-2009 07:54
What's libsl's grid proxy? Never used it before. What's a good site to get just the weather map. I went to some local sites and the weather channel but they show it on a web page.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
03-27-2009 11:23
From: Jesse Barnett
Cheney's alt?????? :p


Ha Ha, Cheney's alt...lol. No, not Cheney here, just someone with a scientific mind....

I received an anonymous email today.... here it is with the response. For whatever reason, the sender is too scared to reply in the forum/show his or her face and confront me directly. Here's the email and my response...

Cyberiade.it Anonymous Remailer wrote:
> What kind of asshole responds to a sincere request for help
> on the SL forums with a smartass and ignorant reply about global warming not being real?
> You don't need to be such a dick.
> ------------------------------------------------------------------------
Global warming isn't real. The atmosphere is 78% nitrogen, 21% oxygen, (that's 99%, leaving 1%). Of that last 1%, 95% of that 1% is water vapor (water vapor is much more of a greenhouse gas than carbon by the way). Carbon makes up 1/3800th of that 1%, or 1/38000th of a percent overall. Carbon dioxide isn't a pollutant, you exhale it, I exhale it, plants take it in and use the carbon, releasing oxygen. All global warming is is a scam perpetrated by Al Gore and his cronies to scare everyone into thinking we need a 'carbon tax' to save the world, when, in reality, it's just a scam to make them rich. Haven't you ever wondered why politicians (but not scientists) believe in global warming? You apparently aren't very scientifically minded, or you'd understand how fake it is. I don't think you're a bad person, I think your intentions are probably sincere. It's just that you've been duped by these people into supporting their intentions. If it's real, than why not support your argument with facts rather than calling me names and hiding behind an anonymous remailer? Why not step out from behind the remailer and show yourself, or at least your avatar. You could have responded in the forum, but instead you chose to send an anonymous email? I really think you should perhaps you should look at real scientific data rather than believing Al Gore's junk science and Marxist/socialist ideas. You'll notice, I'm replying with my real name, and real email, as, I don't need to hide behind an anonymous remailer.
_____________________
My tutes
http://www.youtube.com/johanlaurasia
Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
03-27-2009 11:57
...WOW. Not exactly the answer I was...ah...looking for. lol. But, whether it does or does not exit isn't my problem. The people that are paying my group to do it certainly think so though so I'll work that out. But back to the weather map.... What's libsl's grid proxy? I saw wonderfull looking weather map on the NOAA island.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 12:41
From: Zeta Eizenstark
...WOW. Not exactly the answer I was...ah...looking for. lol. But, whether it does or does not exit isn't my problem. The people that are paying my group to do it certainly think so though so I'll work that out. But back to the weather map.... What's libsl's grid proxy? I saw wonderfull looking weather map on the NOAA island.

PAR uses grid proxy and you can just download the soruce for it if you want. You will have to look through the code to figure out how to inject the textures programatically. The openmv web site and especially their iirc channel would be the best place to recieve help doing it.

http://code.google.com/p/par/

Pay no mind to the thread derailments. Kind of a close knit community so we use and abuse the threads some but still generally answer all questions.

WARNING THREAD DERAILMENT: I had a nice surprise today. I set up a twitter account about a month ago and out of curiosity looked to see if our Prez has an account. I am following his feeds now and a few minutes later my email had a new message:

"Hi, Jesse Barnett (Jesse_Barnett).

Barack Obama (BarackObama) is now following your updates on Twitter."

hahahahahahhaha You just do not see that everyday. I am sure he really pays attention being that he is following over a half million different accounts. Still kind of cool and even as jaded as I am, that still earned a smile and a chuckle from me.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
03-27-2009 12:51
From: Zeta Eizenstark
What's libsl's grid proxy? Never used it before. What's a good site to get just the weather map. I went to some local sites and the weather channel but they show it on a web page.

NOAH and NWS would be the place for the maps. For example:

http://www.hpc.ncep.noaa.gov/noaa/national_forecast.jpg
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-27-2009 15:31
Wow Johan. That's quite...vehement. I can't blame you for getting a little miffed about the anonymous e-mail, which was not very polite. I hope that's what prompted the content of your e-mail. Otherwise, before claiming that no scientists believe in global warming, you might want to take an environmental engineering/physics class. The wonder is that ANY politician lent his voice to something science unravelled a long time ago, which will have repercussions over a much longer time period than any one politician's term in office.

Anyway, that's all I'll say on that. Back to your regularly scheduled scripting foo. ;-)
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
03-27-2009 21:17
From: Hewee Zetkin
Wow Johan. That's quite...vehement. I can't blame you for getting a little miffed about the anonymous e-mail, which was not very polite. I hope that's what prompted the content of your e-mail. Otherwise, before claiming that no scientists believe in global warming, you might want to take an environmental engineering/physics class. The wonder is that ANY politician lent his voice to something science unravelled a long time ago, which will have repercussions over a much longer time period than any one politician's term in office.

Anyway, that's all I'll say on that. Back to your regularly scheduled scripting foo. ;-)



Yeah.. you can look back at my first post in this thread to see what I said. It was a smart ass remark, and the OP's thread wasn't really the place for me to say it. I was venting more than anything and my apologies to the OP for dragging the thread away from the OP's original questions. One last thing, pretty much the only scientists who support the whole global warming gig are paid by Gore, or are forced to comply by being threatened with having research funds pulled unless they agree. As a matter of fact, since it's been proven that the earth is starting to cool, they've changed the name from 'global warming' to 'global climate change'. That alone should tell one it's a lie. I'll shut up now in this thread though so that the OP can get the answers needed.
_____________________
My tutes
http://www.youtube.com/johanlaurasia
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
03-28-2009 00:19
From: Johan Laurasia
One last thing, pretty much the only scientists who support the whole global warming gig are paid by Gore, or are forced to comply by being threatened with having research funds pulled unless they agree.

That's crap. A lifelong friend of mine is actually one of the scientists researching global warming. He is not being paid by Gore, and since he's a meteorologist with a steady career rather than a research scientist depending on grants and funds, he is in no way in danger of losing his funding by not 'going along'.

I understand that you have strong feelings on the subject, but you are not well informed. There's no global conspiracy, you cannot truthfully make statements that everyone who believes in global warming is 'in on it'.

Like any other issue, there are very smart people on both sides who are have good reason to believe as they do, and dismissing the issue as a conspiracy is pretty offensive and doesn't demonstrate a rational consideration.
_____________________
1 2 3