web services - Nusoap doesn't work with PHP password_hash function? -
i write simple web service login process .net. using nusoap php library server side. in server side hashing given password , query in database check if there such hashed password. in .net getting error response text/html format while waitings text/xml format. error password_hash function doesn't founden php's built-in function. , check functions in seperate .php file , works without error same encrypting , decrypting(password_verify). going wrong in situation?
this code;
function systemlogin($mycomplexlogin) { $result=null; $conn=openconnection(); // check connection if ($conn->connect_error) { //return("connection failed: " . $conn->connect_error); return $result; } $enterpriseid=mysqli_real_escape_string($conn,$mycomplexlogin["enterpriseid"]); $username=mysqli_real_escape_string($conn,$mycomplexlogin["username"]); $password=$mycomplexlogin["password"]; $cost=10; $hash=""; $hash=password_hash($password, password_bcrypt, ["cost" => $cost]); /* create prepared statement */ $stmt = $conn->stmt_init(); // prepare , bind if($stmt = $conn->prepare("select * mydatabase.users binary username=?")) { $stmt->bind_param("s", $username); // execute query $stmt->execute(); /* bind result variables */ $stmt->bind_result($resultid,$resultlastname,$resultfirstname,$resultaddress,$resultposition,$resultmanager,$resultusername,$resultpass); /* fetch value */ if($stmt->fetch()) { if(password_verify($password,$hash)) { //date("y-m-d h:i:s"); $token=date("y-m-d h:i:s"); $result= array( 'id' => $resultid, 'lastname'=>$resultlastname, 'firstname' => $resultfirstname, 'address'=>$resultaddress, 'position'=>$resultposition, 'manager'=>$resultmanager, 'password' => $resultpass, 'username' => $resultusername, 'token' => $token ); } } // close statement $stmt->close(); } mysqli_close($conn); return $result; }
looks something's wrong headers. server should sending back
header("content-type: text/xml\r\n");
but instead sending back
header("content-type: text/html\r\n");
maybe check wsdl file or figure out why not outputing xml client
i wonder if hitting error https://github.com/fergusean/nusoap/blob/463c772ae805aed7f396d89e6dce1dc0ce4c038b/lib/class.soap_server.php#l295
Comments
Post a Comment