I'm calling this part 1, because I hope to follow it up at some point, although... who knows!
I wanted to be able to upload my photos from my N95 directly to my website, and notice that S60 phones appear to have an option to upload to Flickr and Vox using the 'online services' system, so I figured adding my own shouldn't be too hard. After a bit of googling, I found this:
Having the spec made it pretty trivial. My examples below are using symfony, but are really very basic, so you should be able to figure it out. At some point, I intent to make a class to handle this, and maybe release it. Currently, the data is stored in a database 'as-is', but processing it wuold be trivial
If you don't understand how this works, read the spec. If you still don't understand, don't contact me about it unless you're willing to pay for implementation
# apps/frontend/modules/nokia/actions/actions.class.php
<?phpclass nokiaActions extends sfActions
{ public
function executeIndex
() { // deliberatly empty! } public
function executePost
() { $this->
getResponse()->
setStatusCode(201);
$stream =
fopen("php://input",
"r");
$data = stream_get_contents
($stream);
fclose($stream);
$n =
new Nokia
();
$n->
body =
$data;
$n->
save();
}}
# apps/frontend/modules/nokia/templates/indexSuccess.php
<?php echo '<?xml version="1.0"?>'; ?>
<feed xmlns="http://purl.org/atom/ns#">
<link type="application/x.atom+xml" rel="service.post" href="http://www3.pookey.co.uk/nokia/post" title="pookey"/>
<link type="application/x.atom+xml" rel="service.feed" href="http://www3.pookey.co.uk/nokia/feed" title="pookey"/>
<link type="application/x.atom+xml" rel="service.upload" href="http://www3.pookey.co.uk/nokia/upload" title="pookey"/>
<link type="application/x.atom+xml" rel="service.categories" href="http://www3.pookey.co.uk/nokia/categories" title="pookey"/>
<link type="text/html" rel="alternate" href="http://www3.pookey.co.uk/" title="pookey"/>
</feed>
# apps/frontend/modules/nokia/templates/postSuccess.php
<?php echo '<?xml version="1.0"?>'; ?>
<entry xmlns="http://purl.org/atom/ns#">
<title>Test</title>
<summary>moo</summary>
<issued>2004-11-16T13:04:04Z</issued>
<link type="text/html" rel="alternate" href="http://whatever.com" title="HTML" />
<id>testmoo</id>
</entry>