I
I
Ivan2018-11-02 21:43:38
PHP
Ivan, 2018-11-02 21:43:38

json pass data in header. How to do it?

Hello! Please help me figure it out. Such a situation, this is what is written
"Private methods accept a token and a request signature in the headers. The token is passed in the X-API-Token header. The request signature is passed in the X-API-Sign header."
How to actually transfer this token and signature using the post method? Here is my request.

if( $curl = curl_init() ) { 
        curl_setopt($curl, CURLOPT_URL, 'https://api...'); 
        curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); 
        curl_setopt($curl, CURLOPT_POST, true); 
        curl_setopt($curl, CURLOPT_POSTFIELDS, $open_orders); 
        $open_orders = curl_exec($curl);  // 
        curl_close($curl); 
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hOtRush, 2018-11-02
@skapunker

curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'X-API-Token: token',
    'X-API-Sign: sign'
));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question