Skip to content

Instantly share code, notes, and snippets.

@hataiit9x
Last active November 3, 2021 01:54
Show Gist options
  • Save hataiit9x/472a0c4ad5b777f6074941c2dfa655ca to your computer and use it in GitHub Desktop.
Save hataiit9x/472a0c4ad5b777f6074941c2dfa655ca to your computer and use it in GitHub Desktop.
pushLogs
<?php
public function pushLogs($msg, $post_data)
{
//curl実行
$data = [
"message" => $msg,
"data" => $post_data
];
$ch_exec = curl_init("https://{domain}/api/debug-logs");
curl_setopt($ch_exec, CURLOPT_POST, true);
curl_setopt($ch_exec, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch_exec, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch_exec, CURLOPT_TIMEOUT, 2);
curl_setopt($ch_exec, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt(
$ch_exec,
CURLOPT_HTTPHEADER,
[
'Content-Type: application/json; charser=UTF-8',
'Accept: application/json; charser=UTF-8',
'Authorization: Bearer {token}'
]
);
$result = curl_exec($ch_exec);
//curl_exec($ch);
curl_close($ch_exec);
//print_r($result);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment