| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
require_once('../lib/nusoap.php'); |
|---|
| 13 |
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : ''; |
|---|
| 14 |
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : ''; |
|---|
| 15 |
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : ''; |
|---|
| 16 |
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : ''; |
|---|
| 17 |
echo 'You must set your username and password in the source'; |
|---|
| 18 |
exit(); |
|---|
| 19 |
$username = ''; |
|---|
| 20 |
$password = ''; |
|---|
| 21 |
$client = new soapclient("http://staging.mappoint.net/standard-30/mappoint.wsdl", true, |
|---|
| 22 |
$proxyhost, $proxyport, $proxyusername, $proxypassword); |
|---|
| 23 |
$err = $client->getError(); |
|---|
| 24 |
if ($err) { |
|---|
| 25 |
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; |
|---|
| 26 |
} |
|---|
| 27 |
$client->setCredentials($username, $password, 'digest'); |
|---|
| 28 |
$address = array( |
|---|
| 29 |
'AddressLine' => '563 Park Avenue', |
|---|
| 30 |
'PrimaryCity' => 'New York', |
|---|
| 31 |
'SecondaryCity' => 'Brooklyn', |
|---|
| 32 |
'Subdivision' => '', |
|---|
| 33 |
'PostalCode' => '', |
|---|
| 34 |
'CountryRegion' => 'US', |
|---|
| 35 |
'FormattedAddress' => '' |
|---|
| 36 |
); |
|---|
| 37 |
$findRange = array( |
|---|
| 38 |
'StartIndex' => 0, |
|---|
| 39 |
'Count' => 10 |
|---|
| 40 |
); |
|---|
| 41 |
$findResultMask = 'AddressFlag'; |
|---|
| 42 |
$findOptions = array( |
|---|
| 43 |
'Range' => $findRange, |
|---|
| 44 |
'SearchContext' => 1, |
|---|
| 45 |
'ResultMask' => $findResultMask, |
|---|
| 46 |
'ThresholdScore' => 0.85 |
|---|
| 47 |
); |
|---|
| 48 |
$findAddressSpecification = array( |
|---|
| 49 |
'DataSourceName' => 'MapPoint.NA', |
|---|
| 50 |
'InputAddress' => $address, |
|---|
| 51 |
'Options' => $findOptions |
|---|
| 52 |
); |
|---|
| 53 |
$findAddress = array('specification' => $findAddressSpecification); |
|---|
| 54 |
$result = $client->call('FindAddress', array('parameters' => $findAddress)); |
|---|
| 55 |
|
|---|
| 56 |
if ($client->fault) { |
|---|
| 57 |
echo '<h2>Fault</h2><pre>'; |
|---|
| 58 |
print_r($result); |
|---|
| 59 |
echo '</pre>'; |
|---|
| 60 |
} else { |
|---|
| 61 |
|
|---|
| 62 |
$err = $client->getError(); |
|---|
| 63 |
if ($err) { |
|---|
| 64 |
|
|---|
| 65 |
echo '<h2>Error</h2><pre>' . $err . '</pre>'; |
|---|
| 66 |
} else { |
|---|
| 67 |
|
|---|
| 68 |
echo '<h2>Result</h2><pre>'; |
|---|
| 69 |
print_r($result); |
|---|
| 70 |
echo '</pre>'; |
|---|
| 71 |
} |
|---|
| 72 |
} |
|---|
| 73 |
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'; |
|---|
| 74 |
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; |
|---|
| 75 |
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; |
|---|
| 76 |
?> |
|---|
| 77 |
|
|---|