Created
July 3, 2021 19:38
-
-
Save aeknarinamn/054a17e33164c457b93e74d45e3cb287 to your computer and use it in GitHub Desktop.
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 | |
require_once __DIR__ . '/vendor/autoload.php'; | |
/*Get Data From POST Http Request*/ | |
$datas = file_get_contents('php://input'); | |
/*Decode Json From LINE Data Body*/ | |
$deCode = json_decode($datas,true); | |
$client = new MongoDB\Client( | |
'mongodb+srv://admin:[email protected]/myFirstDatabase?retryWrites=true&w=majority'); | |
$db = $client->TEST; | |
$collection = $db->line_user_data; | |
$insertOneResult = $collection->insertOne( | |
$deCode | |
); | |
http_response_code(200); | |
// printf("Inserted %d document(s)\n", $insertOneResult->getInsertedCount()); | |
// var_dump($insertOneResult->getInsertedId()); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment