View previous topic :: View next topic |
Author |
Message |
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
Ethernet Development Board |
Posted: Mon Jun 07, 2010 8:52 am |
|
|
I have the Ethernet development board from CCS and I am just powering it up and reading the exercise book for the first time.
I want the device to act like a HTTP client. I want the dev board to send HTTP requests to my webserver on the internet. I want it to send data, like analog1, along with the HTTP request.
Ex
Code: | http://www.website.com?val1=2333;val2=444 |
Is this possible with the ENC28J60 and 18F4620 development board?
I want to get this data to my website for later retrieval. I could also use FTP if the Dev board can send data to my FTP server on the internet. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Jun 07, 2010 5:24 pm |
|
|
To send the data back would sort of be another session with a POST or possibly a GET with your return results in the URL request.
So yes. it's possible.
I'm guessing you've never written any web apps on a PC either?
You'll want a server with CGI's enabled. Consider using TCL to start since it works so nicely with strings, and that's pretty much most web pages.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Tue Jun 08, 2010 2:15 am |
|
|
If the PIC is the client then yes you can create a request such as you have done but your's is slightly wrong:-
Code: |
http://www.website.com/page.php?val1=2333&val2=444
|
notice the & instead of the ; and you need the file to pass the data to (page.php)
You may have to create the request yourself unless there is a function provided for you. An http request looks like
You could use cgi on the server side but it would proberbly be easier for you if you used PHP. Are you setting up your own server or using one of the many internet provided ones ?
With PHP you just access the values in the request using
Code: |
$val1 = $_GET['val1'];
$val2 = $_GET['val2'];
|
And you just need to write this to a file.
You could provide a response back to the PIC but is not required. If you don't you may loose data!
If you wanted it to be a little more secure you could use a POST request from the PIC but that requires quite a bit more code.
Have you done much web app design ? |
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Tue Jun 08, 2010 7:12 am |
|
|
I noticed later I had used ; instead of & in my example, sorry.
I do already have the website ready and waiting for data. I wrote the code using Visual Studio. This is my first website, so I can't say I have all my duck in a row....
The ethernet kit is a bit greek to me but as long as I am not starting down any blind alley, I think I can get er going.
Thanks for the replies! |
|
|
|