How can I hit a link such as http://somewhere.com/client.php?locationID=1 and return the value of the location id from a C# windows forms application?
Trying to get an HTTPGetRequest from a C# Windows Forms Application.
Not sure where to start or how this would be done.
Thanks
Now, we can create a Winform application to consume the Web API and upload/download the files from web server to our local machine. Open Visual Studio 2015. Click New >> Project >> Visual C# >> Windows >> select Windows Forms Application. Enter your project name and click OK.
C# GET request with HttpClientHttpClient provides a base class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI. Program.cs. using var client = new HttpClient(); var content = await client. GetStringAsync("http://webcode.me"); Console.
try this:
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(@"http://somewhere.com/client.php?locationID=1");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string content = new StreamReader(response.GetResponseStream()).ReadToEnd();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With