- 论坛徽章:
- 0
|
.net的web service没有,google的到做过
作了一个调用google的web service代码如下:
- $query = '上海';
- $key = 'CMDusl5QFHIEnwCvJKbCPgFOOMxzoiJy';
- $num = 10;
- //$soapoptions = array('namespace' => 'urn:GoogleSearch',
- //'trace' => 0);
- $soap_client= new SoapClient("http://api.google.com/GoogleSearch.wsdl",$soapoptions);
- print"<pre>";
- $params = array(
- 'key' => $key, // the Developer's key
- 'q' => $query, // the search query
- 'start' => 0, // the point in the search results should Google start
- 'maxResults' => 10, // the number of search results (max 10)
- 'filter' => false, // should the results be filtered?
- 'restrict' => 'countryCN',
- 'safeSearch' => false,
- 'lr' => 'lang_zh-CN',
- 'ie' => '',
- 'oe' => ''
- );
- $response=$soap_client->__soapCall("doGoogleSearch",$params);
- //echo $soap_client->__getLastRequest()."\n";
- //echo $soap_client->__getLastResponse()."\n";
- //var_dump($response);
- for($i=0;$i<$num;$i++)
- {
- $res[] = $soap_client->__soapCall("doGoogleSearch",$params);
- $i++;
- }
- print_r($res);
- //$soap_client->doGoogleSearch();
- //var_dump($soap_client->__getTypes());
复制代码 |
|