I started using Arduino about a month back. Very amateur in this regard. So i apologize first for any stupid question.
My project requires to read and write data from a mysql server. For writing to server I used post method and it works fine.
My wifi device is Xbee wifi. Phant library provided by sparkfun is being used here. I am using softwarewerial. So while reading, my code is like this:
softwareserial xb(6,7);
xB.print(phant.get());
phant.get is defined like this :
String Phant::get() {
String result = "GET / .csv HTTP/1.1\n";
result += "Host: " + _host + "\n";
result += "Connection: close\n";
return result;
}
My php code is supposed to return a series of numbers in comma separated value(csv) format. I have already checked this php file through other method (eg. postman ) and it does return the data in specified format.
The xbee wifi device is also 'hitting' (if thats the term !) the server, because if I put a wrong syntax in it, I can see the error reporting in the php error log file. So connection is alright.
my question is here, xb.print() is by default supposed to return an int value. where as the get function inside it is returning a string value. how can i retrieve the returned value by phant.get() ?
Records in a GET request are separated by carriage return/line feed, not just one.
Do you really have a file on the server called .csv? A .csv file is NOT executable, so making a GET request is NOT going to do anything, and will NOT generate a return stream to read.
So, you have a file called index.php. Why are you not GETting index.php? You realize, I hope, that the browser does some behind-the-scenes magic based on the URL you are asking for and what is actually on the server. Your Arduino is not doing that magic. You should not make assumptions.
what do you mean when u said the response of GED doesn't come through serial port.. my xbee wifi is connected using softwareserial. and i am receiving data by using for example xB.read(). i am getting confused.
If you are using a WiFi device that is connected to Serial, then forget what I said about the response not coming through Serial. The Ethernet shield and WiFi shield do not use Serial to communicate with the Arduino.
the reason why i was trying to use serial port is because with software serial, some of my data packets were missing while receiving. any suggestion in that regard?
arif_1:
I can receive the same data on another machine using the same wifi network.
Could be an issue with your arduino wifi setup. As WIFI is now a some what generic wireless term, does the xbee directly connect to your router? Below is a link to a simple test file link you might try to see if it is correctly received.