问题描述
求高手帮忙把一段C#的程序翻译成PHPHttpWebRequestrequest=(HttpWebRequest)WebRequest.Create("http://......");request.Method="POST";request.KeepAlive=false;request.AllowAutoRedirect=true;request.ContentType="application/json";request.Accept="application/xml";request.Headers.Add("X-Auth-Token",HttpUtility.UrlEncode("openstack"));byte[]btBodys=Encoding.UTF8.GetBytes("");request.ContentLength=btBodys.Length;request.GetRequestStream().Write(btBodys,0,btBodys.Length);HttpWebResponsehttpWebResponse=(HttpWebResponse)request.GetResponse();StreamReaderstreamReader=newStreamReader(httpWebResponse.GetResponseStream());stringresponseContent=streamReader.ReadToEnd();httpWebResponse.Close();streamReader.Close();request.Abort();httpWebResponse.Close();
时间: 2024-10-28 20:32:26