使用Groovy和Apache XML-RPC访问SNIPPLR

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用Groovy和Apache XML-RPC访问SNIPPLR相关的知识,希望对你有一定的参考价值。

  1. import org.apache.xmlrpc.client.XmlRpcClient
  2. import org.apache.xmlrpc.client.XmlRpcClientConfigImpl
  3.  
  4. def XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl()
  5. config.setServerURL(new URL("http://snipplr.com/xml-rpc.php"))
  6. def XmlRpcClient client = new XmlRpcClient()
  7. client.setConfig(config)
  8.  
  9. Object[] params = ["[yourAPIkey]"]
  10. def result = client.execute("user.checkkey",params)
  11. println result
  12.  
  13. params = ["[yourAPIkey]","groovy"]
  14. result = client.execute("snippet.list",params)
  15. println result

以上是关于使用Groovy和Apache XML-RPC访问SNIPPLR的主要内容,如果未能解决你的问题,请参考以下文章