Last active
November 13, 2015 07:57
-
-
Save takeshiyako2/b4c76eb118873368af60 to your computer and use it in GitHub Desktop.
PHP with Go lang bbpd
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 | |
$url = "http://localhost:12333/GetItemJSON"; | |
$postdata = "{\"Key\": {\"Id\": {\"S\": \"my_user_id1\"}}, \"TableName\": \"ProductCatalog\"}"; | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
echo $result; |
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 | |
$random = substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyz'), 0, 36); | |
$url = "http://localhost:12333/PutItemJSON"; | |
$postdata = "{\"Item\": {\"Id\": \"$random\",\"Title\":\"Book 107 Title\",\"ISBN\":\"111-1111111111\",\"Price\":\"33\",\"Authors\":[\"Author1\", \"Author2\"]},\"TableName\": \"ProductCatalog\"}"; | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
echo $result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment