/** * POST $data to the given $url * * @param string $url ADN API URL * @param array $data */ public function post($url, $data) { $data_string = json_encode($data); $curl = new Http\Curl(); $curl->request($url, array('method' => 'POST', 'timeout' => '5000', 'body' => $data_string, 'headers' => array('Content-type' => 'application/json', 'Content-Length' => \Podlove\PHP\strlen($data_string)))); $response = $curl->get_response(); $body = json_decode($response['body']); if ($body->meta->code !== 200) { \Podlove\Log::get()->addWarning(sprintf('Error: App.net Module failed to Post: %s (Code %s)', str_replace("'", "''", $body->meta->error_message), $body->meta->code)); } }
private function get_text_for_episode($post_id) { $post = $this->replace_tags($post_id); if (\Podlove\PHP\strlen($post['text']) > 256) { $post['text'] = \Podlove\PHP\substr($post['text'], 0, 255) . "…"; } return array('text' => $post['text'], 'link_annotation' => $post['posted_linked_title']); }