I am trying to consume a restful webservice written in PHP(returns JSon response) in Windows Form application. It gives some html in response saying
This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support
Web Service
//Slim based php webservice
$app->get(
"/books",
function () use ($app) {
$books[0] = array(
"id" => "1",
"name" => "lifeGoesOn" ,
"author" => "nomibhaii"
);
$books[1] = array(
"id" => "2",
"name" => "lifesaysgoodbye" ,
"author" => "nomibhaii"
);
$app->response()->header("Content-Type", "application/json");
return json_encode($books);
}
)
;
C# Code : On button click I make a request but response in unexpected some html
private void button1_Click(object sender, EventArgs e)
{
string response = null;
using (var client = new WebClient())
{
response = client.DownloadString("http://nomi.byethost5.com/api/index.php/books");
if (response != "")
{
resultBox.Text = response;
}
}
}
I get this response Response :
<html>
<body>
<script type="text/javascript" src="/aes.js" ></script><script>functiontoNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("cf92896f26e0006666f074859130bb95");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";location.href="http://nomi.byethost5.com/api/index.php/books?ckattempt=1";</script><noscript>
This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript>
</body>
</html>