C#PHP GET标头值?

I try to access php file on server with c# client. The problem: I can not $_GET['name'] value on my php code.

C# Code:

        WebRequest request = WebRequest.Create("http://www.test.org/example.php");
        request.Credentials = CredentialCache.DefaultCredentials;

        request.Headers.Add("name", "test");

        WebResponse response = request.GetResponse();

        Console.WriteLine(((HttpWebResponse)response).StatusDescription);

        Stream dataStream = response.GetResponseStream();

        StreamReader reader = new StreamReader(dataStream);

        Console.WriteLine(reader.ReadToEnd());

PHP Code:

echo "Hello I am example.php
";

if (isset($_GET['name']))
    echo $_GET['name'];
else
    echo "Failure";

Output always:

OK

Hello I am example.php

Failure

Press any key to continue . . .

The _GET on PHP side gets you query parameters. NOT header values. From your C# code you are sending in header values. In your C# code you need to send in query parameters. In your C# code do this

WebRequest request = WebRequest.Create("http://www.test.org/example.php?name=test");