2016-01-11 4 views
6

私の仕事はリンク先の投稿をページから共有することです。私はドキュメンテーションでリンクしてきましたが、何をすべきか理解できませんでした。 私は数日間グーグルで行きました。私は明確なアイデアを得ていませんでした。投稿をリンクスに共有するには

linkedinに共有する方法を誰かが明確に説明できますか。私は全体のページを共有したくないが、特定の投稿のみを共有したい。

私はネットから得たコードですが、このコードで何が起こっているのか分かりません。

<html> 
<head> 
<script type="text/javascript" src="//platform.linkedin.com/in.js"> 
    api_key: xxxxxxxxx 
    authorize: true 
    onLoad: onLinkedInLoad 
</script> 
<script type="text/javascript"> 
     // Setup an event listener to make an API call once auth is complete 
    function onLinkedInLoad() { 
     IN.Event.on(IN, "auth", shareContent); 
    } 
    // Handle the successful return from the API call 
    function onSuccess(data) { 
     console.log(data); 
    } 
     // Handle an error response from the API call 
    function onError(error) { 
     console.log(error); 
    } 

    // Use the API call wrapper to share content on LinkedIn 
    function shareContent() { 
      // Build the JSON payload containing the content to be shared 
     var payload = { 
      Content-Type: application/json 
      x-li-format: json 
      "comment": "Check out developer.linkedin.com!", 
      "content": { 
       "title": "LinkedIn Developers Resources", 
       "description": "Leverage LinkedIn's APIs to maximize engagement", 
       "submitted-url": "https://developer.linkedin.com", 
       "submitted-image-url": "https://example.com/logo.png" 
      }, 
      "visibility": { 
       "code": "anyone" 
      } 
     }; 

     IN.API.Raw("/people/~/shares?format=json") 
    .method("POST") 
    .body(JSON.stringify(payload)) 
    .result(onSuccess) 
    .error(onError); 
    } 

</script> 
</head> 
<body> 
    <script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script> 
    <script type="IN/Share"></script> 
</body> 
</html> 

コードと一緒に他のファイルが必要ですか?

私はcodeigniterで働いています。

助けてください。

ありがとうございます。

答えて

0

私はあなたのJavaScriptコードを読んで、あなたが実際にしたいことをしていますが、私はあなたがバックエンド言語のようなPHPやnodejsでこれを行うべきだと思います。

これを行うには、Linked inのREST APIを使用する必要があります。
すべてのREST APIのアーキテクチャーは同じです。まず、アカウントを認証してからリクエストを送信し、同じセッションでレスポンスを受け取り、必要な処理を行う必要があります。

編集:私はあなたがhere

にしたい正確に何を見つけた
関連する問題