-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.php
More file actions
47 lines (29 loc) · 1.12 KB
/
server.php
File metadata and controls
47 lines (29 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
class server {
private $connection;
public function __construct(){
$this->connection = (is_null($this->connection)) ? self::connect() : $this->connection;
}
static function connect() {
$host = "dw-12345.postgres.database.azure.com";
$port = "5432";
$dbname = "postgres";
$user = "web@dw-12345";
$password = "Dw1234567890";
$connection_string = "host={$host} port={$port} dbname={$dbname} user={$user} password={$password} ";
echo "connection String";
return pg_connect($connection_string);
}
public function getCustomerName($id_array) {
$id = $id_array['id'];
$sql = "select nombre from public.clientes where id = '$id'";
$query = pg_query($this->connection, $sql);
$result = pg_fetch_assoc($query);
return $result['nombre'];
}
}
$params = array('uri' => 'localhost/pedidos-soap/server.php');
$server = new SoapServer(NULL, $params);
$server->setClass('server');
$server->handle();
?>