Last active
November 3, 2021 01:54
-
-
Save hataiit9x/472a0c4ad5b777f6074941c2dfa655ca to your computer and use it in GitHub Desktop.
pushLogs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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