我需要测试API
这是我的代码: -
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$body = @file_get_contents('php://input');
$json = json_decode($body, true);
if (isset($json['email'])) {
$email = $json['email'];
$stmt = $db->query("SELECT count(*) as count FROM usersnew where email = '". $email."'");
$results = $stmt->fetchall();
$count = $results['0']['count'];
//TODO: check in db for existing entry
if($count==0){
//updated to add zipcode
$data = array(
'name' => $json['name'],
'email' => strtolower($json['email']),
'password' => $json['password'],
'phone' => $json['phone'],
'birthday' => $json['birthday'],
'sex' => $json['sex'],
'optin' => $json['opt_in'],
'zipcode' => $json['zip'],
'partnerid' => 'app001'
);
我正在尝试的是
curl -H "Content-Type: application/json" -d '{"version":"0"}'
但在这种情况下没有输出我认为-d可能会有所不同(我想是这样)
帮帮我