rootx
|
  |
| Joined: 14 Jun 2012 |
| Total Posts: 375 |
|
|
| 18 Dec 2013 11:03 AM |
| I know I shouldn't be posting here. But SH isn't helping at all. I'm asking for an example postasync() and an example php script that would store data onto a text file, I'll convert it to store into a database later. I just would like an example to get started. Thanks! :) |
|
|
| Report Abuse |
|
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 18 Dec 2013 02:29 PM |
SH doesn't even know Lua, why would you even attempt asking them for help in a server language? Roblox throws this new system at us where only 0.0001% of the community (who isn't actually going to use it for anything) is able to use it effectively and never bothers explaining anything more than the fact that it does work.
If there's some way to own and manage an online database using Lua or javascript then say so, because those would be the most convenient languages. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 18 Dec 2013 02:33 PM |
| @Waffle: It can be done in any language as long as there are libraries for it (there are for Lua but I don't know about JS). HTTPService could also be used for accessing web APIs. |
|
|
| Report Abuse |
|
|
lombardo2
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 1604 |
|
| |
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 18 Dec 2013 06:11 PM |
| I made a HTTP request console app yesterday with VB out of boredom because for one, it is VB so it would be easy, and two is because I had just tried it out with JavaScript in the chrome js console, and I wanted a more efficient method to use it. |
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 18 Dec 2013 06:12 PM |
| use requests and practice with em.* Y they no implement edit button o3o |
|
|
| Report Abuse |
|
|
StBashkir
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26171 |
|
|
| 18 Dec 2013 07:35 PM |
@rootx >>>>>>>>>>> Lua local s = Game:GetService([==[HttpService]==]); -- / Assumes HttpEnabled is true local info = { Test = "Hello"; } local json = s:JSONEncode(info); local data = s:PostAsync([=[http://site/file.php]=], json); print(data) -- will print what the php script echoes <<<<<<<<<<<
>>>>>>>>>>> php [file.php] $raw_post = file_get_contents("php://info"); $json = json_decode($raw_post);
echo($json['Test']); //This should be the string 'Hello' <<<<<<<<<<<
|
|
|
| Report Abuse |
|
|
|
| 18 Dec 2013 07:36 PM |
"local s = Game:GetService([==[HttpService]==]);" why do you code so weird |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2013 07:46 PM |
([==[HttpService]==]);
Why do you code like that? ._. |
|
|
| Report Abuse |
|
|
200AB
|
  |
| Joined: 24 Aug 2010 |
| Total Posts: 1604 |
|
|
| 18 Dec 2013 08:54 PM |
Forgive me if I sound incredibly stupid, but why "php://info"? Is it just an example? If so, what would be the correct usage? I don't understand how it works either way, because if the data is posted to file.php, how is getting the contents of "php://info" (which can't be an existing file, so I have no clue how that would work) catch the posted data?
I'm not really new to web development, just to HTTP's POST and GET, and everything involved with them, as I've never had to use them. |
|
|
| Report Abuse |
|
|
200AB
|
  |
| Joined: 24 Aug 2010 |
| Total Posts: 1604 |
|
| |
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 21 Dec 2013 01:58 PM |
| Oh, and I tried PHP last night in some web hosting service, and couldn't get $_GET to return what I wanted it to back to my console. How does that work? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Dec 2013 02:13 PM |
^ Just do this as a test:
>php: if(isset($_GET["test"])) echo "Success: " . (string)$_GET["test"]; else echo "Not test";
>lua: x=game:GetService("HttpService") print(x:GetAsync("yourURL.blah?test=adf");
It should print Success: adf
Make sure the HttpEnabled property is true |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2013 02:40 PM |
| I just made a website and my game posts all the stats of the players onto it. It's not very hard if you look around. |
|
|
| Report Abuse |
|
|
YAYZMAN23
|
  |
| Joined: 05 Oct 2012 |
| Total Posts: 883 |
|
|
| 23 Dec 2013 12:18 PM |
This worked better me to get the raw post.
$raw_post = $HTTP_RAW_POST_DATA;
crush, kill, destroy, swag |
|
|
| Report Abuse |
|
|
keehl257
|
  |
| Joined: 12 May 2013 |
| Total Posts: 122 |
|
|
| 12 Jun 2014 02:28 PM |
There is a web file set that my friends company had made that lets you make complete web sites out of lua, and html. Np php or javascript is required. It even has functions inm its model set for sql..I beleive that it will do just as you had asked, but I'm sure you wont use it lol. Just wanted to say that you can really use any language you wish as long as you have the tables for it...
BTW, hi, I hadn't seen you since before anaminus's script builder closed. |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 12 Jun 2014 03:34 PM |
| How would you ungzip the data sent with :PostAsync()? I have been trying since a long time and found no working ways in php... |
|
|
| Report Abuse |
|
|
|
| 13 Jun 2014 06:04 PM |
@mini gzuncompress might work.
crush, kill, destroy, swag |
|
|
| Report Abuse |
|
|