Example server code?

Hello
I’m new to the codes community and am trying to get http.request to work according to the examples given with my own server using http.get. Can someone point me to an example of what the format of a server response needs to be or a working example of a server script that responds to get requests? thanks very much!

Well you do need a web site.

Or a public note book/pad

For a free sever I made 1 before

For a online game (not in lua and not published yet)

I already have the server and it currently accepts a get request. I am generating a response and codea’s success callback indicates that it got the response, but the data is empty. I was looking for a working example to help me figure out where I’m going wrong.

Have a look at my simple example with a Mac OSX (Mountain Lion) Apache server running on a local computer.
The post is from 25 July.

Maybe this can help you a bit…

Re Peter

thanks Peter. I’ll check it out.

Hi Peter
I looked at your example and it’s not exactly what I had in mind.
I am issuing a http get request that looks as follows:
http://www.myserver.com/extapi?mode=1

The server looks up some information in a MySQL database Based on the mode argument,
Formats it, then sends it back as the response which I
want to then use/manipulate inside Codea.

I wrote this example about storing data in the cloud using Google App Engine:

http://twolivesleft.com/Codea/Talk/discussion/comment/11700

It uses app engine instead of php/mysql, but you should be able to glean the information you need from there. It has an example of formatting your request and getting a response.

Great, I’ll check it out. Thanks!

It’s working! It turns out that my original response was working ok too. The response was too long and the ‘print’ function was apparently silently returning without printing to the stdout window. When I rendered to the main canvas using the text function all was good. Thanks everyone for the tips.