"CICG_SEG_DEV", "UID"=>"sa", "PWD"=>"123"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { echo "Could not connect.\n"; die( print_r( sqlsrv_errors(), true)); } $data = json_decode(file_get_contents('php://input'), true); //print_r($data); if(empty($data['curp'])){ die('Oooops...eso no se puede ;)'); }elseif($data['curp'] !=''){ /* Set up the Transact-SQL query. */ $tsql = "SELECT p.id_personal FROM CICG_SEG_DEV.core.personal p WHERE p.curp = '".$data['curp']."'"; $stmt = sqlsrv_query($conn, $tsql); $result = array(); do { while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)){ $result[] = $row; } } while (sqlsrv_next_result($stmt)); echo json_encode($result); } ?>