public function create(PostInterface $post) { $this->client->setCredentials($this->getFullUrl('posting'), $this->getUsername(), $this->getPassword()); $this->client->newPost($post->getTitle(), $post->getContent()); return $this; }
public function reply(PostInterface $post) { $this->login(); $forumId = null; if ($forums = $post->getForums()) { $forumId = current($forums)->getId(); } $url = sprintf($this->getFullUrl('replying'), $post->getTopic()->getId(), $forumId); $crawler = $this->client->request('GET', $url); $fields = $this->getReplyingFormFields(); $form = $crawler->selectButton($fields->getButton())->form(); usleep(1000); $values = array(); $values[$fields->getContent()] = $post->getContent(); if ($this->hasReplyingTitle()) { $values[$fields->getTitle()] = $post->getTitle(); } $this->client->submit($form, $values); return $this; }