def getToken
uri=URI.parse 'https://api.weixin.qq.com/cgi-bin/token?'
uri.query=URI.encode_www_form(grant_type: "client_credential", appid: "xxxxxxx", secret: "xxxxxxxxx")
http=Net::HTTP.new(uri.host,uri.port)
http.use_ssl=true
request=Net::HTTP::Get.new(uri.request_uri)
response=http.request(request)
body=JSON.parse response.body
end