Advertisement
Guest User

Untitled

a guest
Aug 25th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2. $host = '127.0.0.1';
  3. $db = 'test';
  4. $user = 'root';
  5. $pass = '';
  6. $charset = 'utf8';
  7.  
  8. $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
  9. $opt = [
  10. PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
  11. PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
  12. PDO::ATTR_EMULATE_PREPARES => false,
  13. ];
  14. $pdo = new PDO($dsn, $user, $pass, $opt);
  15.  
  16. <?php
  17. require_once "lib/nusoap.php";
  18. require_once "conexion.php";
  19.  
  20. function muestraPersonas($pdo) {
  21. $consulta = $pdo->query("SELECT * FROM personas");
  22. return $consulta;
  23. }
  24.  
  25. if(!isset($HTTP_RAW_POST_DATA)) {
  26. $HTTP_RAW_POST_DATA = file_get_contents("php://input");
  27. }
  28. $server = new soap_server();
  29. $server->register("muestraPersonas");
  30. $server->service($HTTP_RAW_POST_DATA);
  31.  
  32. <?php
  33. require_once "lib/nusoap.php";
  34. require_once "conexion.php";
  35.  
  36. $cliente = new nusoap_client("http://localhost/WebService/soap_conexion.php");
  37.  
  38. $resultado = $cliente->call("muestraPersonas",$pdo);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement