Home > Net >  C # weather API interface
C # weather API interface

Time:10-06

"The great spirit show how c #, receive weather API interface method, and are you to recommend the c # advanced tutorial or have good books recommend, thanks a lot!

CodePudding user response:

Is a get or post request, parameters are those parameters, you on baidu search request request, c # code, just changed the parameters of the request, the data returned is json, you check the c # operation json, baidu

As to what the advanced tutorials and books what is bullshit,
Baidu is the best teacher

CodePudding user response:

Thanks for sharing, I have checked in baidu, may be the contents of the search is not clear, still have even if I don't know where to start with, such as how to new project, web projects or form

CodePudding user response:

reference 1/f, 711 glaciers response:
is a get or post request, parameters are those parameters, you on baidu search request request, c # code, just changed the parameters of the request, the data returned is json, you check the c # operation json, baidu

As to what the advanced tutorials and books what is bullshit,
Baidu is the best teacher in the

Thanks for sharing, I have checked in baidu, may be the contents of the search is not clear, still have even if I don't know where to start with, such as how to new project, web projects or form?

CodePudding user response:

It depends on your own needs, you want a web application or winform procedure

CodePudding user response:

reference glaciers, 4/f, 711 response:
it depends on your own needs, you want to web applications or programs for winform

A Windows form, used to display news and weather information

CodePudding user response:

Request the somebody else all say the way to GET the POST, but I suggest using POST, not for other, just to use the comfort

CodePudding user response:

What project can access the API to create

CodePudding user response:

///& lt; Summary> 
///to create a Get request, return HttpWebResponse
///& lt;/summary>
///& lt; Param name="url" & gt;
///& lt; Returns> HttpWebResponse
Public static HttpWebResponse CreateGetHttpResponse (string url)
{
HttpWebRequest request=WebRequest. Create (url) as HttpWebRequest;
Request. The Method="GET";
Request. The ContentType="application/x - WWW - form - urlencoded";//link type
The return request. The method GetResponse () as HttpWebResponse;
}

///& lt; Summary>
///to create a Get request, return the string
///& lt;/summary>
///& lt; Param name="url" & gt;
///& lt; Returns> String
Public static string CreateGetHttpResponseStr (string url)
{
HttpWebRequest request=WebRequest. Create (url) as HttpWebRequest;
Request. The Method="GET";
Request. The ContentType="application/x - WWW - form - urlencoded";//link type
Return GetResponseString (request. The method GetResponse () as HttpWebResponse);
}

///& lt; Summary>
///the HttpWebResponse into string
///& lt;/summary>
///& lt; Param name="webresponse & gt;"
///& lt; Returns> String
Public static string GetResponseString (HttpWebResponse webresponse)
{
Using (Stream s=webresponse GetResponseStream ())
{
StreamReader reader=new StreamReader (s, Encoding UTF8);
Return reader. ReadToEnd ();
}
}

CodePudding user response:

The weather in webservice is best

CodePudding user response:

HttpWebRequest, HttpClient 2 can be implemented,

CodePudding user response:

This simple, data, analysis the ok, HttpWebRequest more flexible
  •  Tags:  
  • C#
  • Related