请求指导我在android中了解json解析并且可以从直接URL读取json对象,例如可以从http://api.androidhive.info/contacts/读取信息。
问题: - 我想通过使用Async Http Post Method
来调用API函数方法:POST Api键值每次发布验证 带参数的Verifylogin Post(如何传递参数)
我的Api代码
if ( $_POST['api_key'] == 'abc1239op3rt' )
{
if( $_POST['action'] == 'verifylogin')
{
if(trim($_POST['email']) == "")
{
echo json_encode( array('status' => 'failure', 'message' => 'Please enter email address. ') );
exit(0);
}
elseif(trim($_POST['password']) == "")
{
echo json_encode( array('status' => 'failure', 'message' => 'Please enter password. ') );
exit(0);
}
else{
$result = verifylogin( $_POST['email'], $_POST['password'] );
$status = "";
if($result != false)
{
$data = $result;
$message = "Login Successfully.";
$status = "success";
}
else
{
$data = $result;
$message = "Error! Try again.";
$status = "failure";
}
echo json_encode( array('status' => $status, 'message' => $message,'data' => $data) );
exit(0);
}
}
}