Arduino + WiFly send GET to web server

I’m working on a project with a Arduino Diecimila, ADXL335 Accelerometer, and the WiFly

shield.

I have used the WiFly Wireless Talking SpeakJet Server (http://www.sparkfun.com/commerce/tutori … als_id=158) as a primary guide to understanding and communicating to and from the Artduino with the WiFly shield.

Everything has worked great as far as connecting to our WiFi network, communicating to and from the Arduino over this WiFi connection and getting a basic HTML page from the Arduino.

What I have not been able to do so far is successfully hit a web server FROM the arduino.

I have tried to use the open command (a WiFly command) to open a connection to a server and then send the test of an HTTP request which I then close. I have tried this manually through a serial connection to the arduino and in my sketch.

Here is the code snippet from that sketch I am trying to use as a test:

Serial.println(“Opening Connection to HTTP Server”);

SPI_Uart_print(“$$$”);

delay(500);

SPI_Uart_println(“open 172.16.48.195 80”);

delay(3000);

Serial.println(“Sending GET request to server”);

SPI_Uart_println(“GET /ard/test.php?arvalue=arduinotest HTTP/1.1”);

delay(800);

SPI_Uart_print(“$$$”);

delay(500);

Serial.println(“Closing Connection to HTTP Server”);

SPI_Uart_println(“close”);

delay(500);

SPI_Uart_println(“exit”);

delay(500);

Flush_RX();

The functions used in this code are from the tutorial referenced above from Sparkfun.

I’m sure there is something I’m missing but I can not see any evidence in my apache logs that any attempts are being received from the arduino.

I also can not find any additional indications through the WiFly docs as to other approaches or options.

Any ideas or guidance is very welcomed.

Thanks!!

Hi…

I’ve been working a bit with the WiFly lately…

fifer:
I have tried to use the open command (a WiFly command) to open a connection to a server and then send the test of an HTTP request which I then close. I have tried this manually through a serial connection to the arduino and in my sketch.

I think that the Arduino serial monitor connection didn't work for me when I tried to retrieve a web page.

What operating system are you using? I have successfully used the ‘screen’ command (available on OS X and Linux) to retrieve a web page.

From memory I needed to turn off a WiFly on-connect message to avoid an error message from the server but if your Apache logs aren’t showing a connection attempt it may not even be making it that far.

Here is the code snippet from that sketch I am trying to use as a test:

 (snip)
  SPI_Uart_println("GET /ard/test.php?arvalue=arduinotest HTTP/1.1");
At a minimum I think the above line needs to be followed by sending a blank line.

Also, the end of line needs to have both ‘\r’ and ‘\n’ to work with some servers.

If you know how to use telnet you could try that to check you can access your server first.

If you’re using OS X or Linux I can be more specific about how to use screen (e.g. you need to send Ctrl+J as well and Enter/Return).

I also can not find any additional indications through the WiFly docs as to other approaches or options.

Rumour has it that the reason I've spent so much time with the WiFly lately is because I'm working on a library for it. :) Unfortunately it's not quite yet at the stage of doing web page retrievals otherwise I'd ask if you wanted to alpha-test it. :)

If you try these suggestions and they don’t work I might’ve made further progress with the library by then.

–Philip;