Example #1
0
 /**
  * Get Stream Resource
  *
  * @return resource
  *   HTTP Stream
  */
 public function getStream()
 {
     return $this->adapter->getStream();
 }
Example #2
0
 /**
  * Wrapper method for POST Request routines
  */
 private function sendPost()
 {
     /**
      * @internal
      * If we have Raw Data to send, "normal" POST Data
      * will be send as Raw too, because they are considered the same
      */
     if (count($this->rawPostData) != 0) {
         $POSTDATA = implode('&', array_merge($this->postData, $this->rawPostData));
     } else {
         $POSTDATA = http_build_query($this->postData, '', '&');
     }
     // If we have any POST Daata to send...
     if (!empty($POSTDATA)) {
         $this->adapter->getContext()->setOptions(array('http' => array('content' => $POSTDATA)));
         /**
          * @internal
          * ... we have to add the proper Content-type Header Field,
          * if missing, in order to be sure a PHP Error will not be raised
          */
         if ($this->headers->find('Content-Type') === FALSE) {
             try {
                 $this->headers->addHeader(new ContentType('application/x-www-form-urlencoded'));
             } catch (FieldsException $e) {
                 // Silenced because we're 100% sure this FieldsException will never be caught :P
             }
         }
     }
 }