I've made a Restful Webservice
with Slim. (See below).
As you can see there is a authentication.
$app = new \Slim\Slim();
$app->add(new \Slim\Middleware\HttpBasicAuthentication([
"users" => [
"root" => "example",
"user" => "example"
]
]));
$app->get('/example/:name', function($name){
echo json_encode($name);
});
Now I tried to connect with Windows Phone
. Without the authentication everything went fine. But I can't get it work with it.
Here is my code for Windows Phone
so far:
Uri endpointUri = new Uri( "http://domain/example/check");
using ( HttpClient client = new HttpClient())
{
List<Example> c;
HttpResponseMessage response = await client.GetAsync(endpointUri);
var jsonResponse = await response.Content.ReadAsStringAsync();
c= JsonConvert.DeserializeObject<List<Example>>(jsonResponse);
System.Diagnostics.Debug.WriteLine(c[0].id);
}
Hope you can help me.