Skip to content

failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request #6

@sstable

Description

@sstable

Hi, This SDK has a bug.

PHP Warning:  file_get_contents(https://sandbox.ebanx.com/ws/request): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
 in /data/aa/aa/vendor/ebanx/ebanx/src/Ebanx/Http/Client.php on line 154
PHP Fatal error:  Uncaught RuntimeException: Bad HTTP request:  in /data/aa/aa/vendor/ebanx/ebanx/src/Ebanx/Http/Client.php:166
Stack trace:
#0 /data/aa/aa/vendor/ebanx/ebanx/src/Ebanx/Command/AbstractCommand.php(91): Ebanx\Http\Client->send()
#1 /data/aa/aa/vendor/ebanx/ebanx/src/Ebanx/Ebanx.php(64): Ebanx\Command\AbstractCommand->execute(Array)
#2 /data/aa/aa/vendor/ebanx/ebanx/examples/checkout.php(11): Ebanx\Ebanx::__callStatic('doRequest', Array)
#3 {main}
  thrown in /data/aa/aa/vendor/ebanx/ebanx/src/Ebanx/Http/Client.php on line 166

How to reproduce the bug

  1. Set key to the file. example/bootstrap.php

  2. run php checkout.php

How to fix that.

  1. Open & find function send in Client.php file.

  2. change $context http -> header array to

 "Content-Type: application/x-www-form-urlencoded \r\n" .
 "User-Agent: EBANX PHP Library " . \Ebanx\Ebanx::VERSION . "\r\n" 

:)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions