Slide 5
Slide 5 text
HTTP通信する方法
$context = stream_context_create([
'http' => [
'method'
=> 'POST',
'header'
=> implode("\r\n", [
'Content-Type: application/json',
'Authorization: Bearer secret-token',
]),
'content'
=> json_encode($data),
'timeout'
=> 3.0,
'ignore_errors' => true,
],
]);
$body = file_get_contents($url, false, $context);