Click here to Skip to main content
11,934,809 members (51,629 online)
Rate this:
Please Sign up or sign in to vote.
I'm trying to create a code in Windows Phone 8 for sending a basic GET request to a PHP file in the format http://localhost/get_request.php?username=sops
How do I do this?
Posted 10-Mar-13 9:35am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


You can use something like below code snippet to achieve it.
WebClient webClient = new WebClient();
// Register the callback
webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
webClient.DownloadStringAsync(new System.Uri(YOUR_URL));
void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
    if (e.Error == null)

Here YOUR_URL will be "http://localhost/get_request.php?username=sops".

CoolSops 10-Mar-13 19:19pm
Is the "GetResponseAsync" method present in Windows Phone 8 API? I tried looking it for at but couldn't find any. Did you import any additional libraries? Sorry, if my question sounds like a total noob but I'm used to programming with Java and not with .Net
Prasad Khandekar 11-Mar-13 3:59am

Updated the sample. Instead of HttpWebRequest it now uses WebClient which is much easy to work with.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100