微信開發者平臺建立接口獲取Token*

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
相關文章
相關標籤/搜索