2012-01-11 75 views
0

我用这LinkedIn插件CakePHP的2.0.4:https://github.com/ProLoser/CakePHP-LinkedInCakePHP 2.0 LinkedIn插件 - 发布分享?

我设置的一切工作的罚款登录并获得用户的配置文件一样的名字,姓氏,...使用此语法函数:$ this-> Linkedin->找到( “全部”,...)。我将Linkedin数据源的默认名称“Linkedin”更名为“LinkedinSource”,因此我可以将我的模型“Linkedin”称为我的方便。

我跟着文件/Plugin/Linkedin/Model/LinkedinMessage.php在我的LinkedIn模型来创建此功能:

function updateStatus($message) { 
    $request = $this->request; 
    $request['uri']['path'] = 'people/~/shares'; 
    $this->request = $request; 
    //Above 3 lines are used to bypass the error "changing value of overloaded object property has no effect if I use $this->request["uri"]["path"] = "..." 

    $data = array(
     'comment' => $message 
     , 'visibility' => array('code' => 'anyone') 
    ); 
    //Above settings follow this: https://developer.linkedin.com/documents/share-api 

    $saved = $this->save($data); 
} 

当我用我自己的LinkedIn账号上面的代码运行(连接& $ saved的价值只是TRUE但是当我在浏览器(谷歌浏览器)上打开我的帐户时,无状态/份额过帐到我的LinkedIn帐户

我试图将URI路径更改为

$request['uri']['path'] = 'people/~/person-activities'; 

,并请求数据:

$data = array(
     'content-type' => "linkedin-html" 
     , 'body' => $message 
    ); 

https://developer.linkedin.com/documents/post-network-update但仍然没有较好的效果。

我也改变这些线/Plugin/Linkedin/Config/LinkedinSource.php

$config['Apis']['LinkedinSource']['write'] = array(
    // http://developer.linkedin.com/docs/DOC-1044 
    'mailbox' => array(
     'people/~/mailbox' => array(
      'subject', 
      'body', 
      'recipients', 
     ), 
    ), 
); 

$config['Apis']['LinkedinSource']['write'] = array(
    // http://developer.linkedin.com/docs/DOC-1044 
    'mailbox' => array(
     'people/~/mailbox' => array(
      'subject', 
      'body', 
      'recipients', 
     ), 
    ), 
    //https://developer.linkedin.com/documents/share-api 
    'shares' => array(
     'people/~/shares' => array(
      'comment', 
      'content', 
      'visibility', 
     ), 
    ), 
); 

,但仍没有较好的效果。

就指出我在/Plugin/Linkedin/Model/LinkedinMessage.php

public $startQuote; 
    public $endQuote; 

添加这些行,以避免这些错误:

Undefined property: LinkedinSource::$startQuote [CORE/Cake/Model/Model.php, line 1269] 
Undefined property: LinkedinSource::$endQuote [CORE/Cake/Model/Model.php, line 1269] 

我不知道这是否会导致我的问题或不是,但我想在这里列出所有细节。

请帮助,因为我花了差不多一天的时间,使这项工作,但仍无法:(

回答

1

发现问题!在Content-Type的必须是为了工作应用/ JSON!我还以为x-li-format:json就够了,但它不是。