Appreciated for you reply.
Yes I used REST calls. Below is some key source code. Please help to
check.
__init__.php
require_once "osapi/osapi.php";
// Enable logger.
osapiLogger::setLevel(osapiLogger::INFO);
osapiLogger::setAppender(new osapiFileAppender("/tmp/logs/
osapi.log"));
// Allow users to select which test they would like to run from the
querystring
$osapi = false;
$strictMode = true;
//$userId = '@me';
//$appId = '@app';
// Create an identifier for the local user's session
session_start();
$localUserId = session_id();
// Select the appropriate test and initialize
$userId = $_REQUEST["viewerId"];
//$userID = '17513231080983199596';
$provider = new osapiOrkutProvider();
//$provider->rpcEndpoint = null;
$auth = new osapiOAuth2Legged("orkut.com:29643050208", "54F/
MRo8U5MSCk5V2uWK6ajD", $userID);
$osapi = new osapi($provider, $auth);
index.php:
require_once "__init__.php";
if ($osapi) {
echo "enter";
if ($strictMode) {
$osapi->setStrictMode($strictMode);
}
// Start a batch so that many requests may be made at
once.
$batch = $osapi->newBatch($provider,$auth,
$strictMode);
$user_params = array(
'userId' => $userId,
'groupId' => '@self',
'count' => 10
);
$batch->add($osapi->activities->get($user_params),
'userActivities');
echo $userId;
$result = $batch->execute();
}
gadge xml:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="test2" width="765" height="600">
<Require feature="opensocial-0.8"/>
</ModulePrefs>
<Content type="html" view="canvas">
<![CDATA[
<script>
gadgets.util.registerOnLoadHandler(init);
function init() {
request();
}
function request() {
var params = {};
params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
= [opensocial.Person.Field.ID];
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER,
params), "viewer");
req.send(response);
}
function response(data) {
var viewer = data.get("viewer").getData();
var container = '<iframe frameborder="0" width="765px"
height="600px" scrolling="no" align="top"
src="http://colordancer.66234.ftpdo.com/index.php/index/testCopen?
from=orkut.com&viewerId=' +
viewer.getId() + "'></iframe>';
document.getElementById('iframe').innerHTML = container;
}
</script>
<div id="iframe"></div>
<!-- ALm6fM1md5ai5fplnXsCJ85Mbg1a8ZiGTPn0QDwSkFpDKe1CIKheatWws/
2H07l843u85eT8USvdX5SYS3Yk7t1k7coJ27qOSHU8vj37hkLmGikE00ryX79khcsxUYcYNnLcgnMKnUcFt3JRG1Y2e8xFpsuOAyMt
+2UnQ0fDUW6+/FMPpyO7Y2c= -->
]]>
</Content>
</Module>
Thanks in advance.
On 4月12日, 上午3时24分, Robson Dantas <[email protected]> wrote:
> Hi,
>
> You´re using REST calls, right ? Please post here which steps you took to
> setup your app, and also some sourcecode to check.
>
> Thanks,
>
> Robson Dantas
>
> 2010/4/11 colordancer <[email protected]>
>
>
>
> > Hi All,
>
> > After strugglling for 24 hours, I still had not solved this 502
> > problem.
> > I set up a php client application into orkut sandbox.
> > But once i called batch->execute(), the only response is nothing else
> > but 'Unable to reach remote host. HTTP status 502'.
>
> > I searched through google, found some useful tips that said it was
> > because of authentication error.
> > But my test application is nearly the same with the sample code
> > provided with php-client-library.
>
> > Who can kindly help me?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Orkut Developer Forum" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<opensocial-orkut%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/opensocial-orkut?hl=en.- 隐藏被引用文字 -
>
> - 显示引用的文字 -
--
You received this message because you are subscribed to the Google Groups
"Orkut Developer Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/opensocial-orkut?hl=en.