0

I'm using xamarin forms to develop my android app. I'm done with sending data as POST requests now.

I'm currently using GSM Modem (SMS) as a placeholder for other SMS APIs for OTPs in the future. This is the URL that the app gives me: Received URL

As you can see, there are parameters available. Using my browser/PHP, I can easily refresh the page with new values in the parameters. However, in C# I'm quite unfamiliar with filling up these parameters.

I just want my app to send a signal or something to the URL with a dynamic phone and message parameters.

Mohamad Mousheimish
  • 1,641
  • 3
  • 16
  • 48
e700867
  • 41
  • 9
  • Does this answer your question? [Build query string for System.Net.HttpClient get](https://stackoverflow.com/questions/17096201/build-query-string-for-system-net-httpclient-get) – Patrick Beynio Mar 06 '20 at 08:20

1 Answers1

4

What about string interpolation

var url = $"http://192.168.1.102:8090/SendSMS?username={yourusername}&password={yourpassword}&phone={yourphone}&message={yourtext}"

simplest way to send HTTP GET:

var client = new HttpClient();
await client.GetAsync(url)
Maks Shapovalov
  • 154
  • 1
  • 6