I'm working on a Shirt that displays if I have any kind of notification on my Facebook profile. So i wrote a script that get's all the data from the Facebook API. With the Arduino WiFly I'm connecting to the site, where I get the following data back (via Serial.write(WiFly.read());):
What I want to do now is to save the numbers into different variables to be able to work with them.
This is asked quite often, and a bit of searching should find you several threads with examples.
Basically, what you need to do is stop throwing the characters away. Save them in an array, starting with the content portion of the reply (the portion that follows the blank line). That requires that you determine what makes up a line ending. Is it \n, \r, \n\r, or \r\n? Whatever it is, when you see two combinations or individual characters in a row, that is the blank line.
Save the characters that follow into an array.
Then, when the end of message arrives (the client has no more data available and has disconnected), use strtok() (NOT strtok_r()) and atoi() to parse and use the data.
Thank you PaulS! I've searched for it a several times but never found something that really fits for me. Can you please link me a tutorial or something like that. With witch function would I be able to search for the "\n\n" characters?
Maybe I should explain to you that I'm totally new into that
There is a library for a utility called textfinder that can be used to get data out of a text stream. If the number of lines in the header is constant, you might count the line feed characters and save the text between the 13th and 14th line feed characters.