C#C
C#4y ago
25 replies
zandose

❔ HTTP code not returning expected result.

So I have the following code
FormUrlEncodedContent content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("Test1", "Test2") });
Task<HttpResponseMessage> result = client.PostAsync(URL, content);
Task<string> resultContent = result.Result.Content.ReadAsStringAsync();
Debug.Log(resultContent.Result);
Which should send the following
http://zandose1.centralus.cloudapp.azure.com/test.php?Test1=Test2
and then I have some PHP code which should return
Test1=Test2
. If I put
http://zandose1.centralus.cloudapp.azure.com/test.php?Test1=Test2
into a browser it works fine but with the C# code it doesn't get the anything.
Was this page helpful?