使用publishUserAction方法发布到个人资料时出现问题

发布于 2024-10-14 09:51:13 字数 2186 浏览 3 评论 0原文

我正在使用 gigya php sdk,它运行良好,我可以使用socialise.setStatus 方法发布到用户的墙或个人资料,但当我尝试使用publishuseraction 方法时遇到问题。我收到错误请求签名无效。

$method = "socialize.publishUserAction";

$request = new GSRequest($apiKey,$secretKey,$method);

$userAction = new GSDictionary("{\"title\":\"This is my title\", \"userMessage\":\"This is a user message\", \"description\":\"This is a description\",      \"linkBack\":\"http://google.com\", \"mediaItems\":[{\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}]}"); 

$request->setParam("userAction", $userAction);  

$request->setParam("uid", $userUID);  

$response = $request->send();

if($response->getErrorCode()==0){ 
    echo "Success";   
} else { 
    echo ("Error: " . $response->getErrorMessage());
}

使用 $response->getLog() 后更新

apiMethod=socialize.publishUserAction
apiKey=correct_api_key
params={"userAction":{},uid":"MY_UID","format":"json","httpStatusCodes":"false"}
URL=http://socialize.gigya.com/socialize.publishUserAction    postData=uid=urlencoded(MY_UID)&format=json&httpStatusCodes=false&apiKey=correct_api_key×tamp=1296229876&nonce=1.29622987636E%2B12&sig=HEdzy%2BzxetV8QvTDjdsdMWh0%2Fz8%3D
server= web504

我同时使用了 put 方法

$userAction = new GSDictionary();

$userAction->put("title", "This is my title");
$userAction->put("userMessage", "This is my user message");
$userAction->put("description", "This is my description");
$userAction->put("linkBack", "http://google.com");

$mediaItems = array();
$mediaItems[0] = new GSDictionary("{\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}");

和 getLog() 方法。 JSON 方法

$userAction = new GSDictionary("{\"title\":\"This is my title\", \"userMessage\":\"This is a user message\", \"description\":\"This is a description\", 
     \"linkBack\":\"http://google.com\", \"mediaItems\":[ {\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}]}");

我得到同样的错误。使用这两种方法,用户操作都是空的。我很感激任何帮助。

谢谢。

I am using gigya php sdk, It works well I am able to post to user's wall or profile using socialise.setStatus method but I am have problems when I try to use the publishuseraction method. I get an error Invalid request signature.

$method = "socialize.publishUserAction";

$request = new GSRequest($apiKey,$secretKey,$method);

$userAction = new GSDictionary("{\"title\":\"This is my title\", \"userMessage\":\"This is a user message\", \"description\":\"This is a description\",      \"linkBack\":\"http://google.com\", \"mediaItems\":[{\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}]}"); 

$request->setParam("userAction", $userAction);  

$request->setParam("uid", $userUID);  

$response = $request->send();

if($response->getErrorCode()==0){ 
    echo "Success";   
} else { 
    echo ("Error: " . $response->getErrorMessage());
}

UPDATED AFTER USING $response->getLog()

apiMethod=socialize.publishUserAction
apiKey=correct_api_key
params={"userAction":{},uid":"MY_UID","format":"json","httpStatusCodes":"false"}
URL=http://socialize.gigya.com/socialize.publishUserAction    postData=uid=urlencoded(MY_UID)&format=json&httpStatusCodes=false&apiKey=correct_api_key×tamp=1296229876&nonce=1.29622987636E%2B12&sig=HEdzy%2BzxetV8QvTDjdsdMWh0%2Fz8%3D
server= web504

I used both put method

$userAction = new GSDictionary();

$userAction->put("title", "This is my title");
$userAction->put("userMessage", "This is my user message");
$userAction->put("description", "This is my description");
$userAction->put("linkBack", "http://google.com");

$mediaItems = array();
$mediaItems[0] = new GSDictionary("{\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}");

& JSON method

$userAction = new GSDictionary("{\"title\":\"This is my title\", \"userMessage\":\"This is a user message\", \"description\":\"This is a description\", 
     \"linkBack\":\"http://google.com\", \"mediaItems\":[ {\"src\":\"http://www.f2h.co.il/logo.jpg\", \"href\":\"http://www.f2h.co.il\",\"type\":\"image\"}]}");

I get the same error. And User action is empty using both methods. I appreciate any help.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦晓ヶ微光ヅ倾城 2024-10-21 09:51:13

尝试调用 getLog() 以获取有关该错误的更多信息:

if($response->getErrorCode()==0){ 
    echo "Success";   
} else { 
    echo ("Error: " . $response->getErrorMessage());
    print "<pre>";
    print_r($response->getLog());
    print "</pre>";
}

另外,您是否能够使用 SDK 运行 getUserInfo?这是一个简单的测试,也需要签名。使用 PHP SDK 页面上的示例(大约 1/2 路)向下)。

Try calling getLog() for a bit more information about the error:

if($response->getErrorCode()==0){ 
    echo "Success";   
} else { 
    echo ("Error: " . $response->getErrorMessage());
    print "<pre>";
    print_r($response->getLog());
    print "</pre>";
}

Also, are you able to run getUserInfo w/ the SDK? This is a simple test that also requires a signature. Use the example on the PHP SDK page (about 1/2 way down).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文