Skip to content

Instantly share code, notes, and snippets.

@KrotovRoman
Created November 13, 2018 06:28
Show Gist options
  • Select an option

  • Save KrotovRoman/23f515237f1b6fcefb14b6db58ad0d0c to your computer and use it in GitHub Desktop.

Select an option

Save KrotovRoman/23f515237f1b6fcefb14b6db58ad0d0c to your computer and use it in GitHub Desktop.
examples https://github.com/philsturgeon/codeigniter-curl пример запроса с параметрами в заголовке
$url = "http://test.ru/;
$this->curl->create($url);
$this->curl->option(CURLOPT_HTTPHEADER, ['Content-Type: application/json' , "Authorization: Bearer ".$this->api_eth ]);
$this->curl->get();
$result = $this->curl->execute();
$result = json_decode($result);
if (!$result AND $this->curl->error_code > 0) {
echo $this->curl->error_string;
$info = $this->curl->info;
echo "<br>";
foreach ($info as $key => $val) {
echo "<br>";
if (is_array($val)) {
echo $key . " = ";
var_dump($val);
} else {
echo $key . " = " . $val;
}
}
return FALSE;
}
var_dump($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment