Il mio compito è quello di condividere un post a collegato in da una pagina. Sono passato attraverso collegato nella documentazione, ma non riuscivo a capire cosa fare. Ho cercato su Google per giorni e non ho avuto un'idea chiara.Come condividere post su linkedin
Qualcuno può spiegare chiaramente come condividere con linkedin. Non voglio condividere un'intera pagina ma solo un post particolare.
Ecco il codice che ho ricevuto dalla rete, ma non ho idea di cosa stia succedendo in questo codice.
<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>
Sono necessari altri file con i codici?
Sto lavorando in codeigniter.
Per favore aiuto.
Grazie in anticipo.