Help with CGI for Ethernet Shield

Hi Everyone, Can someone point me in the direction on how to develop a app for my website to talk to the Arduino? I can write the arduino code, but i dont really know where to start for the CGI script, any ideas or places to start?

Ideally i'd love to use the processing.js code to get a really nice web GUI working? again has this ever been done?

Thanks

Pete

The php language allows you to build really nice web forms, and has capabilities to talk to the Arduino via serial port, as well.

If you are going to learn something new to develop the web site, I'd recommend php. It's free, it's fast, and it's easy to learn (it's based on C syntax).

I also like using PHP if the Arduino is being used in a "client-ish" mode.

If the Arduino is acting more like a "server", check out the Webduino library: it includes some examples of using Ajax to do web-based GUI stuff.

Ran

Hi, I was planning on using post and get commands and not serial ports. and the website is a paid for hosted site, so it is online 99.9999% of the time. Will php still do all of that?

Will php still do all of that?

Do all of what? PHP is good for creating dynamic web pages. It can interface with the serial port as well as MySQL databases. It’s a great, all around scripting language for web-related programming.

and the website is a paid for hosted site

Are you hoping to control the arduino from a remotely hosted site?

You can do that using PHP, or ASP, or ASP.NET on the hosted site - you will have to understand the http protocol. An easy way is to get the arduino to connect to the site repeatedly and follow what the hosted PHP page says to it. It would take a lot of work to try to keep the arduino constantly connected to the site - so perhaps stay away from that.

Think of it like a voicemail service. The PHP page is the recorded "message" for the arduino, and every couple of seconds, the arduino connects to retrieve the message(s).

I do what I suggested now with my arduino - it connects to a specific website, downloads a dynamic page and follows what is on the page. It interprets the data not as HTML code, but rather as bytes of control codes. With the website, I can upload and download to/from EEPROM, I can see the status of the digital or analog ports, etc.

You probably will need to be familiar with storing state information on the PHP side of things; I.E. When you go to the website to enter some command for the arduino, you will need to store the command data for the next arduino connect to read and react. I don't have a lot of experience with PHP, but it is trivial to do in ASP.NET, and I bet PHP has the same ability.

I bet PHP has the same ability.

It does.

Sidenote: Use an .htaccess-File on the webserver to deny people accessing your PHP-File from their webbrowser. There are good tutorials for creating .htaccess-files with authentication, just use google. If you don't want .htaccess or you're not permitted to use .htaccess on your webspace, try making a authentication in PHP instead. I say this stuff because I made an online highscorelist in php for one of my games once, and people kept messing around with it by making post-forms in HTML.

Good luck with your project!