protected function prepare()
    {
        parent::prepare();

        if (!$this->hasBodyStream()) {
            if (false === $stream = tmpfile()) {
                throw new RuntimeException("Can't create temporary file.");
            }
            fwrite($stream, $this->getBody());
            rewind($stream);
            $this->setBody($stream);
        }

        $this->addOption('url', $this->getUrl());
        $this->addOption('upload', true);
        $this->addOption('body', $this->getBody());
    }
protected function prepare()
    {
        parent::prepare();

        if (!$this->hasBodyStream()) {
            if (false === $stream = tmpfile()) {
                throw new RuntimeException("Can't create temporary file.");
            }
            fwrite($stream, $this->getBody());
            rewind($stream);
            $this->setBody($stream);
        }

        $this->addOption('url', $this->getUrl());
        $this->addOption('upload', true);
        $this->addOption('body', $this->getBody());
    }
protected function prepare ( ) { parent :: prepare ( ) ; if ( ! $ this -> hasBodyStream ( ) ) { if ( false === $ stream = tmpfile ( ) ) { throw new RuntimeException ( "Can't create temporary file." ) ; } fwrite ( $ stream , $ this -> getBody ( ) ) ; rewind ( $ stream ) ; $ this -> setBody ( $ stream ) ; } $ this -> addOption ( 'url' , $ this -> getUrl ( ) ) ; $ this -> addOption ( 'upload' , true ) ; $ this -> addOption ( 'body' , $ this -> getBody ( ) ) ; }
Prepare current request to being executed
@throws RuntimeException
Prepare current request to being executed