ixudra / curl

Custom PHP curl library for the Laravel 5 framework - developed by Ixudra
MIT License
561 stars 128 forks source link

XML by post #67

Closed leviatan21 closed 7 years ago

leviatan21 commented 7 years ago

Why "withData" parameter must be type of array ?

I need to send an XML by post, but it's not possible as array, and can't user "withPackageOption" because is a protected function.

Thanks

elimentz commented 7 years ago

You can do two things: send the xml data as a string a file:

    use Ixudra\Curl\Facades\Curl;

    $response = Curl::to( $url )
        ->withData( array( 'xml' => $xml ) )
        ->post();
    use Ixudra\Curl\Facades\Curl;

    $response = Curl::to( $url )
        ->withData( array( 'foo' => 'bar' ) )
        ->withFile( 'xml', '/path/to/dir/file.xml', 'text/xml', 'fileName.xml' )
        ->post();

Please review the documentation for more detailed instructions

leviatan21 commented 7 years ago

My new service provider do not accept anything ain't an string ( I use this lib with 4 service providers with no problem )

SOAP-ENV:Clienterror in msg parsing: XML error parsing SOAP payload on line 1: Not well-formed (invalid token)

only works when I remove the cast parameter, when work on local, but I need to upload this to AWS, and the composer is performed on each deploy

Thanks

elimentz commented 7 years ago

Can you show the cURL request that you are trying to emulate in the package, or some documentation?