]> git.mxchange.org Git - friendica-addons.git/blobdiff - diaspora/diasphp.php
GContact moved to src
[friendica-addons.git] / diaspora / diasphp.php
index cb7a13cc7fe0323eabfcab63a8ec9275492c303d..6ed0c8ce5319f87af36427ecff953f3cd64011b0 100644 (file)
@@ -5,6 +5,8 @@
  */
 
 class Diasphp {
+       private $cookiejar;
+
        function __construct($pod) {
                $this->token_regex = '/content="(.*?)" name="csrf-token/';
 
@@ -12,6 +14,11 @@ class Diasphp {
                $this->cookiejar = tempnam(sys_get_temp_dir(), 'cookies');
        }
 
+       function __destruct() {
+               if (file_exists($this->cookiejar))
+                       unlink($this->cookiejar);
+       }
+
        function _fetch_token() {
                $ch = curl_init();
 
@@ -61,11 +68,12 @@ class Diasphp {
                return $this;
        }
 
-       function post($text) {
+       function post($text, $provider = "diasphp") {
                // post-daten vorbereiten
                $datatopost = json_encode(array(
                                'aspect_ids' => 'public',
-                               'status_message' => array('text' => $text)
+                               'status_message' => array('text' => $text,
+                                                       'provider_display_name' => $provider)
                ));
 
                // header vorbereiten