I’d reconsider using the Pi at all, afaik the Arduino can (with a wifi/eth shield) post data over the net on its own.
I would probably do something like this:
Generate an UUID for each arduino (you can find php functions for this). This can be used both as a identification and a licensing number.
At spesific times I would check the sensor and post data to the API
post data with the UUID:
[php]{
“id”: “8fd0cb6b-1716-4c09-9122-505cb84bf869”,
“data”: [
{
“time”: “1391969828”,
“someData”: “value”
}
]
}[/php]
if you get no response or an error from server side then store the data to a local store, so that you can post it next time you post data, it may now look something like this:
[php]{
“id”: “8fd0cb6b-1716-4c09-9122-505cb84bf869”,
“data”: [
{
“time”: “1391969828”,
“someData”: “value”
},
{
“time”: “1391944628”,
“otherData”: “value”
}
]
}[/php]
[hr]
On the server side you use json_decode to convert the json to an array of objects, and then store the data to your database.