Example #1
0
 /**
  * @param Wrapper\Form $form
  *
  * @return static
  */
 private function submitForm(Wrapper\Form $form)
 {
     $url = $this->httpClient->getAbsoluteUrl($form->getAction());
     $headers = ['Referer' => $this->getUrl()];
     if ($form->isPost()) {
         parse_str($form->getRawData(), $post);
         $headers['Content-Type'] = 'application/x-www-form-urlencoded';
     } else {
         $url = $this->removeQueryString($url) . '?' . $form->getRawData();
         $post = [];
     }
     $request = $this->httpClient->createRequest($form->getMethod(), $url, $post, [], $headers);
     $this->request($request, true, true);
     return $this;
 }