Chinaunix首页 | 论坛 | 博客
  • 博客访问: 523152
  • 博文数量: 576
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 5020
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-13 14:47
文章分类

全部博文(576)

文章存档

2011年(1)

2008年(575)

我的朋友

分类:

2008-10-14 14:57:43

Google搜索客户端API for C/C++
作者:(TRS Open Lab)



Google 网站上提供了goole search client api for Java和for dot.net的版本,大家可以参考.

For C/C++的版本特点如下
内置XML解析器.
内置gbk/utf-8编码/解码器(包含GBK编码表)
采用Pure C编写,采用标准C接口.
支持http代理.

用户需要在申请key
演示程序中的key是一个网友给我的,仅供测试用,演示程序中的代理可能连接不上,由于没有设置超时,可能处于等待状态(sorry.....)
函数中各个参数的意义和的说明一样,对此不作过多的介绍.

建议在此基础上开发二次应用,如封装成COM,但不得对作者提供的api进行反编译.
如需转载,请注明原作者,谢谢合作.欢迎交流.

函数接口

/************************************************************************/
			/*google search client api for c/c++*/
			/*By littlestar,2003,TRS Open Lab*/
/************************************************************************/
//go  for more information
/*start primitive data types*/
#ifdef _SOAP_TYPES
typedef char * xsd__string;
typedef int xsd__int;
struct xsd__base64Binary 
{
	unsigned char *__ptr;
	int __size;
};
typedef bool xsd__boolean;
typedef double xsd__double;

/*end primitive data types*/

struct DirectoryCategoryArray 
{
	struct typens__DirectoryCategory * __ptr;
	int  __size;
	int  __offset;
};

struct typens__ResultElement
{
	xsd__string  summary;
	xsd__string  URL;
	xsd__string  snippet;
	xsd__string  title;
	xsd__string  cachedSize;
	xsd__boolean  relatedInformationPresent;
	xsd__string  hostName;
	struct typens__DirectoryCategory * directoryCategory;
	xsd__string  directoryTitle;
};

struct typens__doGoogleSearchResponse 
{
	struct typens__GoogleSearchResult * _return_;
};

struct typens__DirectoryCategory 
{
	xsd__string  fullViewableName;
	xsd__string  specialEncoding;
};

struct typens__GoogleSearchResult 
{
	xsd__boolean  documentFiltering;
	xsd__string  searchComments;
	xsd__int  estimatedTotalResultsCount;
	xsd__boolean  estimateIsExact;
	struct ResultElementArray * resultElements;
	xsd__string  searchQuery;
	xsd__int  startIndex;
	xsd__int  endIndex;
	xsd__string  searchTips;
	struct DirectoryCategoryArray * directoryCategories;
	xsd__double  searchTime;
};

struct ResultElementArray 
{
	struct typens__ResultElement * __ptr;
	int  __size;
	int  __offset;
};

struct typens__doSpellingSuggestionResponse 
{
	xsd__string  _return_;
};

struct typens__doGetCachedPageResponse 
{
	struct xsd__base64Binary * _return_;
};
#endif
//建立Soap连接
extern "C" int _stdcall CreateSoapSession(void **SoapSessionHandle,char 
*strServerAdd,char *key);

//设置代理服务器,支持http代理.
extern "C" int _stdcall SetSoapProxy(void *SoapSessionHandle,char 
*strProxyHost,int ProxyPort);

//页面检索
extern "C" int _stdcall doGoogleSearch(void *SoapSessionHandle, xsd__string 
 q, xsd__int  start, xsd__int  maxResults, xsd__boolean  filter, 
xsd__string  restrict_, xsd__boolean  safeSearch, xsd__string  lr, 
xsd__string  ie, xsd__string  oe, struct typens__doGoogleSearchResponse * 
out);

//取得google服务器上的缓存页面
extern "C" int _stdcall doGetCachedPage(void *SoapSessionHandle, 
xsd__string  url, struct typens__doGetCachedPageResponse * out );

//拼写检查
extern "C" int _stdcall doSpellingSuggestion(void *SoapSessionHandle, 
xsd__string  phrase, struct typens__doSpellingSuggestionResponse * out );

//取得SOAP错误消息
extern "C" char* _stdcall GetSoapErrorMessage(void *SoapSessionHandle);

//释放SOAP缓存.
extern "C" int _stdcall FreeSoapCache(void *SoapSessionHandle);

//释放Soap连接
extern "C" int _stdcall FreeSoapSession(void **SoapSessionHandle);
google 提供的wsdl文件








  

  
    
            
      
        
          
          
          
          
          
          
          
          
          
          
          
        
      

      
        
          
          
          
          
          
          
          
          
          
        
      
  
      
        
          
             
          
        
      

      
        
          
             
          
        
      

      
        
          
          
        
      

    
   

  
             
  
    
    
  

  
    
  

  
    
    
  

  
    
  

  

  
    
    
    
    
    
    
    
    
    
    
  

  
              
 
  

  

  

    
      
      
    

    
      
      
    

    
      
      
    

  


  

  
    

    
      
      
        
      
      
        
      
    

    
      
      
        
      
      
        
      
    

    
      
      
        
      
      
        
      
    
  

  
  
    
      
    
  

(全文完)
--------------------next---------------------

还不得进行反编译。哈哈哈,真是笑话。

用sproxy.exe可以产生的代码还有什么可以反编译的意义?在vc.net-〉project->add web reference就可以自动出来的代码有什么反编译的意思?

( foxgrey 发表于 2003-6-19 13:57:00)
 
正因为google提供了java和dot.net的例子,感觉缺了C++的,所以写了个呀..
C#执行环境要装那么.net framework呢. ( littlestar 发表于 2003-6-14 16:38:00)
 
C#或者Java的用起来都很方便,为什么要用C++? ( VC70新手 发表于 2003-6-14 12:56:00)
 

( littlestar 发表于 2003-6-12 9:22:00)
 

提到中文没法处理,只好自己解析utf8了.
不知道哪位大哥将BIG5汉字转化为对应的BIG
如"國"转为"国" ( littlestar 发表于 2003-6-12 9:14:00)
 
WEB Service 应该改为"web services"
我也觉得不好分,还是放在SOAP下吧.
( littlestar 发表于 2003-6-12 8:34:00)
 
这篇文章我无法确定分到哪个类别最合适。
放在SOAP类确实不妥,放在"其它"类? ( wangjun 发表于 2003-6-11 22:12:00)
 
该文章没有正确的归类.
( littlestar 发表于 2003-6-11 21:07:00)
 
供测试嘛 ( littlestar 发表于 2003-6-11 21:05:00)
 
“但不得对作者提供的api进行反编译”
--- 没有源码,你来这里是为了炫耀还是为这程序做广告? ( 周星星 发表于 2003-6-11 8:47:00)
 
.......................................................

--------------------next---------------------

阅读(254) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~