Jota,

    You need to use signed requests to make sure that your application
security is not compromised.
    Let's say you have one user answer the poll, when the user submits the
answer the poll you send the answer and other info to your external servers
using makerequest (signed)

function request(url) {
    var params = {poll_id : 23 ,
                  user_id : xxxxxxxxxxxxx,
                  answer_id : 4};
    params[gadgets.io.RequestParameters.AUTHORIZATION] =
gadgets.io.AuthorizationType.SIGNED;
    gadgets.io.makeRequest(url, response, params);
  };

Please note, i'm providing the url to your external server as an argument to
your function.

On your server, you need to first validate the request to make sure that
it's not spoofed. Depending on your back end language, you'll have to use
the library that implement OAuth
and only carry the operations like inserting or consolidating data if the
requests are properly signed.

http://wiki.opensocial.org/index.php?title=Validating_Signed_Requests

Once your are sure that the requests are genuine, you can perform your
processing , let's say like first (in php)

//Fetch the variables sent in the request body

$poll_id = $_REQUEST['poll_id'];
$user_id = $_REQUEST['user_id'];
$answer_id = $_REQUEST['answer_id'];

// Insert the values into the database
//Query the database for the same poll id
//return the response  in JSON/HTML/Text format

You can in the same way, ask the results for a particular poll using
<os:HttpRequest> in opensocial templates.



On Sat, Aug 15, 2009 at 4:39 AM, Jota <jefferson.ru...@gmail.com> wrote:

> Hi everyone!
>
> I have to build an application to show results from a live poll available
> on Orkut counting votes from all users.
>
> So, I need to store some data from Orkut into an external database to
> consolidate all the votes. Note: I need to show a live-report of the votes
> from all users that have the application and not just the vote from me or my
> friends.
>
> I understand that I need to use a makeRequest signed with OAuth to write
> the votes from each one and read the data consolidated from everyone who
> vote in the poll from an external server.
>
> *Could anyone help me sending a complete tutorial with a how to Write data
> to an external database and read it back?*
>
> I've tried to follow these articles, but it's not working properly:
> http://wiki.opensocial.org/index.php?title=Introduction_To_Signed_Requests
> http://wiki.opensocial.org/index.php?title=Validating_Signed_Requests
>
> When I put the fetchme.php on my server, I can't get the correct message. I
> think it's wrong on Wiki.
>
>
> regards,
> Jota
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
To unsubscribe from this group, send email to 
opensocial-orkut+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to