Welcome Guest, Not a member yet? Register   Sign In
CurlRequest - skips header
#1
Exclamation 

All other headers working fine, but this one is skipping.. Have tried change order, make 'cb-access-timestamp:'.time(), make duplicates and that does not help..

Message from response:

Code:
array(1) {
  [0]=>
  string(52) "{"message":"CB-ACCESS-TIMESTAMP header is required"}"
}


Code:
PHP Code:
        $client Services::curlrequest([
            'base_uri' => 'https://api.pro.coinbase.com',
            'debug' => '/var/www/html/logs/curl.txt'
        ], nullnullfalse);

        $client->setHeader('CB-ACCESS-TIMESTAMP'$timex);
        $client->setHeader('CB-ACCESS-SIGN'$this->signature('/orders'null$timex'GET'));
        $client->setHeader('CB-ACCESS-KEY''*******');
        $client->setHeader('CB-ACCESS-PASSPHRASE''******');
        $client->setHeader('user-agent''MI-6');
        $client->setHeader('Accept''application/json');
        $client->setHeader('Content-Type''application/json');

        $response $client->request('GET''/orders', [
            'http_errors' => false,
            'headers' => [
                'CB-ACCESS-TIMESTAMP' => $timex
            
]
        ]); 

Debug:
Code:
*  Trying 104.17.6.188:443...
* TCP_NODELAY set
* Connected to api.pro.coinbase.com (104.17.6.188) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: none
  CApath: /etc/ssl/certs
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Coinbase, Inc.; CN=*.pro.coinbase.com
*  start date: Sep 16 00:00:00 2019 GMT
*  expire date: May 12 12:00:00 2020 GMT
*  subjectAltName: host "api.pro.coinbase.com" matched cert's "*.pro.coinbase.com"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x564cdf0a6bc0)
> GET /orders HTTP/2
Host: api.pro.coinbase.com
CB-ACCESS-SIGN: *****
CB-ACCESS-KEY: *****
CB-ACCESS-PASSPHRASE: *****
user-agent: MI-6
Accept: application/json
Content-Type: application/json

* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 400
< date: Fri, 24 Jan 2020 01:27:28 GMT
< content-type: application/json; charset=utf-8
< content-length: 52
< set-cookie: __cfduid=d26d0cd1859a628dc3d24d135d13cd5571579829248; expires=Sun, 23-Feb-20 01:27:28 GMT; path=/; domain=.pro.coinbase.com; HttpOnly; SameSite=Lax
< access-control-allow-headers: Content-Type, Accept, cb-session, cb-fp, cb-form-factor
< access-control-allow-methods: GET,POST,DELETE,PUT
< access-control-allow-origin: *
< access-control-expose-headers: cb-before, cb-after, cb-gdpr
< access-control-max-age: 7200
< cache-control: no-store
< etag: W/"34-n7AAWBn5kXep0M3voEb/tDaUq40"
< strict-transport-security: max-age=15552000; includeSubDomains
< x-content-type-options: nosniff
< x-dns-prefetch-control: off
< x-download-options: noopen
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< cf-cache-status: MISS
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< server: cloudflare
< cf-ray: 559e39a48961647f-FRA
<
* Connection #0 to host api.pro.coinbase.com left intact

Thanks, for attention!
Reply
#2

$client->setHeader('CB-ACCESS-TIMESTAMP', "{$timex}"); - works, but than it gives timestamp expired, so ill get from coinbase time.
I'm sorry that i ask and after time reproduce my problems (fear to lost days to reproduce problem by myself), i do not know all nuances of CI curl.. Maybe these will help someone in future!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB