| 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 change the source code to specify the location of the WSDL!'; exit(); |
|---|
| 18 |
$client = new soapclient('file://f:/googleapi/GoogleSearch.wsdl', true, |
|---|
| 19 |
$proxyhost, $proxyport, $proxyusername, $proxypassword); |
|---|
| 20 |
$err = $client->getError(); |
|---|
| 21 |
if ($err) { |
|---|
| 22 |
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; |
|---|
| 23 |
} |
|---|
| 24 |
$client->soap_defencoding = 'UTF-8'; |
|---|
| 25 |
|
|---|
| 26 |
echo 'You must set your own Google key in the source code to run this client!'; exit(); |
|---|
| 27 |
$key = 'set your own Google key'; |
|---|
| 28 |
$q = '"Lies and the Lying"'; |
|---|
| 29 |
$start = 1; |
|---|
| 30 |
$maxResults = 10; |
|---|
| 31 |
$filter = false; |
|---|
| 32 |
$restrict = ''; |
|---|
| 33 |
$safeSearch = false; |
|---|
| 34 |
$lr = ''; |
|---|
| 35 |
$ie = ''; |
|---|
| 36 |
$oe = ''; |
|---|
| 37 |
|
|---|
| 38 |
$params = array( |
|---|
| 39 |
'key' => $key, 'q' => $q, 'start' => $start, 'maxResults' => $maxResults, |
|---|
| 40 |
'filter' => $filter, 'restrict' => $restrict, 'safeSearch' => $safeSearch, 'lr' => $lr, |
|---|
| 41 |
'ie' => $ie, 'oe' => $oe |
|---|
| 42 |
); |
|---|
| 43 |
|
|---|
| 44 |
$result = $client->call('doGoogleSearch', $params); |
|---|
| 45 |
|
|---|
| 46 |
if ($client->fault) { |
|---|
| 47 |
echo '<h2>Fault</h2><pre>'; |
|---|
| 48 |
print_r($result); |
|---|
| 49 |
echo '</pre>'; |
|---|
| 50 |
} else { |
|---|
| 51 |
|
|---|
| 52 |
$err = $client->getError(); |
|---|
| 53 |
if ($err) { |
|---|
| 54 |
|
|---|
| 55 |
echo '<h2>Error</h2><pre>' . $err . '</pre>'; |
|---|
| 56 |
} else { |
|---|
| 57 |
|
|---|
| 58 |
echo '<h2>Result</h2><pre>'; |
|---|
| 59 |
print_r($result); |
|---|
| 60 |
echo '</pre>'; |
|---|
| 61 |
} |
|---|
| 62 |
} |
|---|
| 63 |
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'; |
|---|
| 64 |
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; |
|---|
| 65 |
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; |
|---|
| 66 |
?> |
|---|
| 67 |
|
|---|