I'm getting the same problem. I'm not using Arduino, I'm using a Gainspan wifi module.
I send the following:
AT+NCTCP=220.127.116.11,80 CONNECT 0 OK 0 0 POST /update HTTP/1.1 Host: api.thingspeak.com Connection: close X-THINGSPEAKAPIKEY:V*KEY*KEY*B Content-Type: application/x-www-form-urlencoded Content-Length: 10 sensor1,19OO
The response I get is:
S0HTTP/1.1 301 Moved Permanently Server: nginx/0.8.53 Date: Sun, 11 Mar 2012 03:02:29 GMT Content-Type: text/html Location: https://www.thingspeak.com/ Content-Length: 185 Connection: close <html> <head><title>301 Moved Permanently</title></head> <body bgcolor="white"> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx/0.8.53</center> </body> </html> E DISCONNECT 0
When I use a webbrowser to try to enter data, I have no problems. However, when I'm connected via the module, I get this error.
Any ideas what could be wrong here?
I have seen this issue with certain TCP/IP stacks.
Try using HTTP 1.0 in the request and let me know if that works. If not, I will keep digging.
Also, just to confirm, I've looked up the DNS with the same module. The response I get for api.thingspeak.com
0 AT+DNSLOOKUP=api.thingspeak.com 18.104.22.168
I tried sending 1.0 and received the same response:
POST /update HTTP/1.0 Host: api.thingspeak.com Connection: close X-THINGSPEAKAPIKEY:VF*KEY*KEY*B Content-Type: application/x-www-form-urlencoded Content-Length: 10 sensor1,19OOS0HTTP/1.1 301 Moved Permanently Server: nginx/0.8.53 Date: Mon, 12 Mar 2012 04:14:00 GMT Content-Type: text/html Location: https://www.thingspeak.com/ Content-Length: 185 Connection: close <html> <head><title>301 Moved Permanently</title></head> <body bgcolor="white"> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx/0.8.53</center> </body> </html>
Okay, it's not the HTTP 1.1 thing.
Are you posting, "sensor1,19OO"? That might be the issue. You need to post, "field1=1900".
Since the update is wrong, the API is forwarding you to the website. I will look into a more verbose error for this situation.
Let us know if that helps.
(PS. We would be interested in hearing more about your project. I don't have any experience with Gainspan, so it would be helpful.)
Thanks! I really appreciate the help with this.
Sorry for the confusion: the "OO" I'm seeing is the modules response to the escape sequences sent to the module over the serial line. The first O is really an <esc>O (ok response for entering the escape sequence) and then another <esc>O (ok response for exiting the escape sequence).
To be clear, there is no <CRLF> after the data entered (the data being entered is sensor1,19).
I would be more than happy to share my code and any of the other problems we encounter. I'm working on a program for our LEGO MINDSTORMS sensor, the WIFI sensor: http://www.dexterindustries.com/wifi.html
Problem solved! Thanks for your help with this.
The problem was really dropped bytes from the LEGO MINDSTORMS NXT to the wifi module. This has been corrected and I will be releasing the example code a little later in the week, on our blog: http://www.dexterindustries.com/blog
One quick tip for everyone: I used a program called Fiddler to test HTML POST data. The program allows you to rapidly try different formats. It gives very detailed information, including hex code, on the message and response.
Most Users Ever Online: 114
Currently Browsing this Page:
Guest Posters: 1
Administrators: Hans, lee