2012-01-11 76 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就夠了,但它不是。