-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.php
55 lines (42 loc) · 1.35 KB
/
client.php
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
48
49
50
51
52
53
54
55
<?php
// wsdl cache 'ini devre disi birak
ini_set("soap.wsdl_cache_enabled", "0");
$opts = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
);
$options = array(
'login' => 'ornek',
'password' => 'ornek',
'trace' => 1,
'exceptions' => 0,
'stream_context' => stream_context_create($opts)
);
try {
// SOAPClient nesnesi olustur
$client = new SoapClient("http://okesmez.com/php-soap-v2/server.php?wsdl",$options);
$ornekInput = new \stdClass();
$ornekInput->name = 'Omer';
$ornekInput->second_name = 'Faruk';
$ornekInput->phone = '0000000000';
$response = $client->ornek($ornekInput);
if(isset($_GET['request'])){
header("Content-type: text/xml");
die($client->__getLastRequest());
} else if(isset($_GET['response'])){
header("Content-type: text/xml");
die($client->__getLastResponse());
}
echo "Metod basarili bir sekilde calistirildi.<br/>Sonuc asagidadir.<br/>";
echo "<pre>";
// Sonucu ekrana bas
var_dump($response);
echo "</pre>";
foreach($response as $key=>$value){
echo '<strong>'.$key.' : </strong>'.$value.'<br>';
}
} catch (Exception $exc) { // Hata olusursa yakala
echo "Soap service message: " . $exc->getMessage();
}