X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=diaspora%2Fdiasphp.php;h=6ed0c8ce5319f87af36427ecff953f3cd64011b0;hb=e59e019fa19a2e811e914b811058daa9fc372041;hp=cb7a13cc7fe0323eabfcab63a8ec9275492c303d;hpb=c4578aafa0107ba07513eae0ab1fd46afadf9d25;p=friendica-addons.git diff --git a/diaspora/diasphp.php b/diaspora/diasphp.php index cb7a13cc..6ed0c8ce 100644 --- a/diaspora/diasphp.php +++ b/diaspora/diasphp.php @@ -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