*
Upload asset file from string

@param string $url  Url for upload
@param string $body File content
160744
private function _uploadAssetFileFromString($url, $body)
    {
        $blockSize = self::MAX_BLOCK_SIZE;
        $blockIds = [];

        $fileSize = strlen($body);

        if ($fileSize < $blockSize) {
            $this->_uploadAssetFileSingle($url, $body);

            return;
        }

        $totalBytesRemaining = $fileSize;
        $uploadedBytes = 0;

        while ($totalBytesRemaining > 0) {
            $blockContent = substr($body, $uploadedBytes, $blockSize);

            $blockId = $this->_generateBlockId(count($blockIds));

            $blockIds[] = $blockId;
            $this->_uploadBlock($url, $blockId, $blockContent);
            $uploadedBytes += $blockSize;

            $totalBytesRemaining -= $blockSize;
            if ($totalBytesRemaining < $blockSize) {
                $blockSize = $totalBytesRemaining;
            }
        }

        $this->_commitBlocks($url, $blockIds);
    }
682246
public function post($url, $requestBody = null) {
        $posturl = $this->url . $url;
        return $this->restRequest($posturl, 'POST', $requestBody);
    }
112608
public function put($uri, $body = null, array $options = [])
    {
        return $this->request(self::REQUEST_METHOD_PUT, $uri, $body, $options);
    }
1096792
protected function _send_patch_request( $url, $body ) {
		$response = $this->_send_request( $url, array(
			'method' => 'PATCH',
			'body'   => $body,
		) );

		$response_code = wp_remote_retrieve_response_code( $response );
		$this->assertEquals( 200, $response_code, 'The Mailtrap.io API resonse code is not equals to 200.' );

		return $response;
	}
1124167
public function put($url, $content = '')
    {
        $req = $url instanceof Request ? $url : $this->buildRequest('PUT', $url);
        $req->setBody($content);
        return $this->exec($req);
    }
681163
public static function uploadFileBinary($url, $localFile, $headerType = 'XML', $method = 'PUT')
    {
        $method = strtoupper($method);
        $headerType = strtoupper($headerType);

        AsposeApp::getLogger()->info("Aspose Cloud SDK: uploadFileBinary called", array(
            'url' => $url,
            'localFile' => $localFile,
            'headerType' => $headerType,
            'method' => $method,
        ));

        $fp = fopen($localFile, 'r');
        $session = curl_init();
        curl_setopt($session, CURLOPT_VERBOSE, 1);
        curl_setopt($session, CURLOPT_USERPWD, 'user:password');
        curl_setopt($session, CURLOPT_URL, $url);
        if ($method == 'PUT') {
            curl_setopt($session, CURLOPT_PUT, 1);
        } else {
            curl_setopt($session, CURLOPT_UPLOAD, true);
            curl_setopt($session, CURLOPT_CUSTOMREQUEST, 'POST');
        }
        curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($session, CURLOPT_HEADER, false);
        if ($headerType == 'XML') {
            curl_setopt($session, CURLOPT_HTTPHEADER, array('Accept: application/xml', 'Content-Type: application/xml', 'x-aspose-client: PHPSDK/v1.0'));
        } else {
            curl_setopt($session, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'x-aspose-client: PHPSDK/v1.0'));
        }
        curl_setopt($session, CURLOPT_INFILE, $fp);
        curl_setopt($session, CURLOPT_INFILESIZE, filesize($localFile));
        $result = curl_exec($session);
        curl_close($session);
        fclose($fp);
        return $result;
    }
604566
public function put(string $filename, $body): PutCommand
    {
        /** @var PutCommand $command */
        $command = $this->builder->build(PutCommand::class);
        $command->withFilename($filename)->withBody($body);

        return $command;
    }
483488
private function loadImageFromURL($url)
    {
        $image = $this->fetchImageContentFromURL($url);

        if (empty($image)) {
            return;
        }

        if (Utils::isJPGResource($image)) {
            $this->filename = $url;
            $this->extension = 'jpg';
            $this->type = IMAGETYPE_JPEG;
        }

        if (Utils::isPNGResource($image)) {
            $this->filename = $url;
            $this->extension = 'png';
            $this->type = IMAGETYPE_PNG;
        }

        $this->from = 'external';
        $this->resource = imagecreatefromstring($image);
        $this->width = $this->boxWidth = imagesx($this->resource);
        $this->height = $this->boxHeight = imagesy($this->resource);
    }
1312516
public function post($url, $body = [], $headers = [], $options = [])
    {
        return $this->request('POST', $url, $body, $headers, $options);
    }
43940
protected function send($url, array $headers = [], $body = []): ResponseContract
    {
        $endpoint = $url instanceof EndpointContract ? $url : static::to($url);

        return $this->responseWith(
            $this->client->send('POST', $endpoint, $headers, $body)
        );
    }
988874
public String doPost(String url, String body) throws IOException {
        HttpPost httpPost = new HttpPost(getWsapiUrl() + url);
        httpPost.setEntity(new StringEntity(body, "utf-8"));
        return doRequest(httpPost);
    }
1117368
private function doUpload ($endpoint, $type, $body)
    {
        return json_decode(
            $this->client->send(
                new Request(
                    'POST',
                    Uri::withQueryValue(new Uri($endpoint), 'type', $type),
                    [],
                    $body
                )
            )->getBody()
        );
    }
180293
public function sendRequest($url, $params, $method)
    {
        if($method=='POST')
        {
            if (!empty($params['file']))
                $ch = $this->initiateUpload($url, $params);
            else
                $ch = $this->initiatePost($url, $params);
        }
        else if($method=='GET')
        {
            $ch = $this->initiateGet($url, $params);
        }
        else if($method=='DELETE')
        {
            $ch = $this->initiateDelete($url, $params);
        }
        else{
            throw new \Exception("Method ".$method." not supported!");
        }

        if (! $ret = curl_exec($ch))
        {
            trigger_error(curl_error($ch));
        }

        curl_close($ch);
        return $ret;
    }
509153
public function setBody($body)
    {
        $this->body = empty($body) ?
            null :
            Stream::factory($body);
    }
488117
public function post($resource, $body = null, $params = [])
    {
        return $this->send($this->prepare('POST', $resource, $body, $params));
    }
907500
public function post($url, $headers = [], $body = null)
    {
        output(func_get_args(),'ppp');
        return $this->send(Method::POST, $url, $body, $headers);
    }
145876
function (body, next) {
                fs.writeFile(out + "/" + path.basename(url), body, function (err) {
                    if (err) {
                        return next(err);
                    }
                    next(null, body);
                });
            }