connection of arduino with my website

hi all,
i have some questions about my graduation project and i will be so thankful if someone helps me.
first i did a website with database using webmatrix i want to know how to send from order from it to arduino as ( turn on light i want to press on it in website and send it to arduino) i heard about get from but i didn’t understand it as it’s my first time to use html
second how to connect my website to arduino to only get requests and orders from my website only "?

thanks alot

i want to know how to send from order from it to arduino as ( turn on light i want to press on it in website and send it to arduino)

The Arduino needs to serve up the web page, containing a form with submit buttons on it, and an action script that refers to the original page.

The browser sends a request for the page, like
GET /LEDControl.htm HTTP 1.0

This request is generated when the user enters
http://arduinoaddress/LEDControl.htm
in the address bar.

When the action field is also LEDControl.htm, and a submit button named 12 with a value of ON is clicked, the browser redirects to
http://arduinoaddress/LEDControl.htm?12=ON
which generates a GET request:
GET /LEDControl.htm?12=ON HTTP 1.0

The Arduino then needs to parse the get request to see what the client is asking for. It is easy to look for the ? in the request, and parse the stuff that follows it, if it is present. If not, serve up the original page.

If it is, perform whatever action the stuff following the ? indicates needs to be done, and serve up a modified page, perhaps showing that the LED on pin 12 is on.

The website you have developed so far is useless, because the Arduino needs to be the server.

hi,
you mean i must put my webpage on arduino to be the server so when i use get function it deals with it right ?
is it possible to make a webpage on arduino with login (username and password) on it ? even for one user !

you mean i must put my webpage on arduino to be the server so when i use get function it deals with it right ?

When your browser generates the GET request, yes.

is it possible to make a webpage on arduino with login (username and password) on it ? even for one user !

Yes, but...

In general a script on the client deals with the submitted data before the GET command gets sent to the server. The client side script encrypts the password. The server then tests the encrypted password against the stored encrypted password. While the Arduino is capable of comparing encrypted arrays of bytes, it generally can't serve up pages that contain client-side code. So, you'll have to send text (password) in clear to the Arduino. Which pretty much negates the security aspect of a login system.

mohamed66:
hi,
you mean i must put my webpage on arduino to be the server so when i use get function it deals with it right ?
is it possible to make a webpage on arduino with login (username and password) on it ? even for one user !

I think that's probably what PaulS means, but there is a better way IMO. It's better to host your web site on a proper fully featured web server so that you can take advantage of all the usual authentication, security, auditing, access controls and so on. This enables you to create a much prettier web site, too. Have your Arduino provide a web service that is invoked by your main web server when required. In effect the Arduino is acting like the business layer in a conventional layered architecture and only has to deal with the commands and queries given to it - the main web server deals with all the presentation side of things. is

first thanks for your reply a lot , i am thinking about doing my webpage on arduino in two pages:
1st page:user send (username + password) to arduino using get form i will save the password and username in arrays and let it compare them with the data user enter if true go to second page that i control things from it

the only problem in that way the website will be for only 1 user ,, also is what i am saying is good or right ?

mohamed66,
Have you looked at the WebDuino library.
It offers some useful routines that might just be what you need, including a basic HTTP authentication method.

Paul

hi
i read about it and i have some questions ... i hope u help me with them

first how to make that if user enter the username and password right redirects him to next page ?

can you show me the part of code can do authentication and redirect ,

thanks alot

first how to make that if user enter the username and password right redirects him to next page ?

This is not an Arduino specific issue. I suggest that you put the Arduino away until you have studied html programming on a PC. When you understand how to do something this basic, get the Arduino back out.

Look at what a submit button on a form does.

hi ,

i knew html and i did a website with login page but my question is it possible to do that in arduino webserver ?
if there a simple way to do that please tell me

i knew html and i did a website with login page

So, let's see it. Post the HTML code. Then, we can help you decide whether the Arduino is capable of doing the same things.

A login page is nothing more than a form with some text entry fields (typically 2) and a submit button and an action method. The Arduino is perfectly capable of serving up such a page.

The action method defines what to do when the submit button is pressed. If the action is to send the text field data as plain text to the server in another GET request, the Arduino is capable of handling that.

If the action requires more complex server side code or any client side code, the Arduino may not be able to handle that.