Php 使用publishUserAction方法发布到配置文件时出现问题

Php 使用publishUserAction方法发布到配置文件时出现问题,php,sdk,gigya,Php,Sdk,Gigya,我使用的是gigya php sdk,它运行良好,我能够使用socialise.setStatus方法发布到用户的墙上或个人资料,但我在尝试使用publishuseraction方法时遇到了问题。我收到一个错误,请求签名无效 $method = "socialize.publishUserAction"; $request = new GSRequest($apiKey,$secretKey,$method); $userAction = new GSDictionary("{\"title

我使用的是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()后更新

我用了两种方法

$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方法

$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\"}]}");
我也犯了同样的错误。使用这两种方法,用户操作都是空的。谢谢你的帮助

谢谢。

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

if($response->getErrorCode()==0){ 
    echo "Success";   
} else { 
    echo ("Error: " . $response->getErrorMessage());
    print "<pre>";
    print_r($response->getLog());
    print "</pre>";
}
if($response->getErrorCode()==0){
呼应“成功”;
}否则{
echo(“错误:”.$response->getErrorMessage());
打印“”;
打印($response->getLog());
打印“”;
}

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

谢谢。我确实按照你的指示做了,并尝试了getUserInfo,它工作正常。我能够获得用户的详细信息。然后,我尝试在更新代码后发布到用户的墙上。仍然是相同的错误,请求签名无效。在logI中,使用这两种方法找到空的userAction。我已经更新了日志和问题中的用户操作。我感谢你的帮助。再次感谢,终于成功了。但我无法添加带有图像或视频等的媒体项,错误:无效参数值“errorDetails”:“无效参数:媒体项中缺少'type'字段”我有类型字段。谢谢你的帮助。
if($response->getErrorCode()==0){ 
    echo "Success";   
} else { 
    echo ("Error: " . $response->getErrorMessage());
    print "<pre>";
    print_r($response->getLog());
    print "</pre>";
}