I want to send data to a php page, which inserts it in a database. I got the following code from Sending data to php from windows phone from but it shows some errors:
- On
using
:System.Net.WebClient
: type used in a using statement must be implicitly convertible toSystem.IDisposable
. - On
UploadString
:System.Net.WebClient
does not contain a definition forUploadString
and no extension methodUploadString
accepting a first argument of the typeSystem.Net.WebClient
could be found (are you missing a using directive or an assembly reference?).
Does anyone have an idea how to fix this?
string URI = "http://www.myurl.com/post.php";
string myParameters = "param1=value1¶m2=value2¶m3=value3";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URI, myParameters);
}