Skip to content

Instantly share code, notes, and snippets.

@drewtang
Created January 25, 2012 21:45
Show Gist options
  • Save drewtang/1678988 to your computer and use it in GitHub Desktop.
Save drewtang/1678988 to your computer and use it in GitHub Desktop.
PHP cURL Activity Post
<html>
<head></head>
<body>
<?php
$ch = curl_init();
$body ="{\"type\":\"text\",\"text\":\"hello\"}"; // type: text, text: hello
$headers = array('Content-Type: application/json');
curl_setopt($ch, CURLOPT_URL,
'https://www.yammer.com/api/v1/streams/activities.json?access_token=[YOUR ACCESS TOKEN]');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$result = curl_exec($ch);
curl_close( $ch );
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment