ixudra / curl

Custom PHP curl library for the Laravel 5 framework - developed by Ixudra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Send text files as raw data

elimentz opened this issue · comments

For example I want to send Text file:

$response = Curl::to( "http://url". "?".http_build_query($data) )
    ->withContentType('text/plain')
    ->withOption('POSTFIELDS', 'this is raw data')
    ->enableDebug(public_path().'/logFile.txt')
    ->post();

Here everything goes well except POSTFIELDS because it is rewritten.
Just in row 405 in Builder.php it can be accomplished by:

$this->curlOptions[ 'POSTFIELDS' ] = isset($this->curlOptions[ 'POSTFIELDS' ]) ? $this->curlOptions[ 'POSTFIELDS' ] : $parameters;