duanli9569 2018-07-20 20:33 采纳率: 100%
浏览 73

用于C#应用程序的PHP MySQL服务器(406不可接受)

I am trying to setup a PHP site to handle the connection to a MySQl database for a C# application. But I can't get the communication between the C# application and the PHP site to work. I always get an "406 Not acceptable" error.

Here is the code from PHP.

<?php
header("Content-type: text/plain");
echo "test";
?>

Here is the C# part.

var request = (HttpWebRequest)WebRequest.Create("http://manoest.dk/UpdateValue.php");
request.Accept = "text/plain";
var test = request.GetResponse();

//WebClient client = new WebClient();
//client.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");           
//string test = client.DownloadString("http://manoest.dk/UpdateValue.php");

I am pretty experienced in C#, but completely new to PHP. Hope that you can help me out.

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站