This is a creation in Article, where the information may have evolved or changed. XML is a remote address
<returnsms><returnstatus>Success</returnstatus><message>ok</message>< remainpoint>150528</remainpoint><taskid>518334</taskid><successcounts>1</ Successcounts></returnsms>
Analytical
struct struct of XML type duanxin struct {returnstatus string ' xml: ' returnstatus ' ' Message string ' xml: ' message ' Remainpoint string ' xml: ' Remainpoint ' ' TaskID string ' xml: ' TaskID ' ' successcounts string ' xml: ' successcounts "'}//texting func send_duanxin (mobile Int64, content String) (dx duanxin, err Error) {m: = StrConv. Formatint (MOBILE) If Len (content) < {return DX, errors. New ("content less than 30 characters")}content = content + "xx company sent" "Sendurl: = Beego. Appconfig.string ("Sendurl") URL: = Sendurl + "&mobile=" + M + "&content=" + contentresp, err: = http. Get (URL) if err! = Nil {return dx, Err}defer resp. Body.close () body, err: = Ioutil. ReadAll (resp. Body) If err! = Nil {return DX, Err}err = XML. Unmarshal (body, &DX)//good convenience, so that the resolution of the XML,SO key is the structure of XML return DX, err}