Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 96227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:46:54+00:00 2026-05-10T23:46:54+00:00

I have a winForms NET3.5SP1 app, and want to POST data to a PHP

  • 0

I have a winForms NET3.5SP1 app, and want to POST data to a PHP page.

I’m also going to be passing it as JSON, but wanted to get straight POST working first.

Here is the code:

    Person p = new Person();     p.firstName = 'Bill';     p.lastName = 'Gates';     p.email = 'asdf@hotmail.com';     p.deviceUUID = 'abcdefghijklmnopqrstuvwxyz';      JavaScriptSerializer serializer = new JavaScriptSerializer();     string s;     s = serializer.Serialize(p);     textBox3.Text = s;     // s = '{\'firstName\':\'Bill\',\'lastName\':\'Gates\',\'email\':\'asdf@hotmail.com\',\'deviceUUID\':\'abcdefghijklmnopqrstuvwxyz\'}'     HttpWebRequest request = (HttpWebRequest)WebRequest.Create('http://www.davemateer.com/ig/genius/newuser.php');     //WebRequest request = WebRequest.Create('http://www.davemateer.com/ig/genius/newuser.php');     request.Method = 'POST';     request.ContentType = 'application/x-www-form-urlencoded';     //byte[] byteArray = Encoding.UTF8.GetBytes(s);     byte[] byteArray = Encoding.ASCII.GetBytes(s);     request.ContentLength = byteArray.Length;     Stream dataStream = request.GetRequestStream();     dataStream.Write(byteArray, 0, byteArray.Length);     dataStream.Close ();      WebResponse response = request.GetResponse();     textBox4.Text = (((HttpWebResponse)response).StatusDescription);     dataStream = response.GetResponseStream ();      StreamReader reader = new StreamReader(dataStream);     string responseFromServer = reader.ReadToEnd ();     textBox4.Text += responseFromServer;      reader.Close ();     dataStream.Close ();     response.Close (); 

And the PHP5.2 code is:

<?php echo 'hello world'; var_dump($_POST); ?> 

this returns back:

array(0) {} 

Any ideas? I want it return the values that I just passed it to prove I can access the data from the server side.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:46:55+00:00Added an answer on May 10, 2026 at 11:46 pm

    i believe you need to properly encode and send the actual post content. it looks like you’re just serializing into JSON, which PHP doesn’t know what to do with (ie, it won’t set it as $_POST values)

    string postData = 'firstName=' + HttpUtility.UrlEncode(p.firstName) +                   '&lastName=' + HttpUtility.UrlEncode(p.lastName) +                                       '&email=' + HttpUtility.UrlEncode(p.email) +                   '&deviceUUID=' + HttpUtility.UrlEncode(p.deviceUUID); byte[] byteArray = Encoding.ASCII.GetBytes(postData); // etc... 

    this should get your $_POST variable in PHP set. later when you switch to JSON you could do something like:

    string postData = 'json=' + HttpUtility.UrlEncode(serializer.Serialize(p) ); 

    and grab from PHP:

    $json_array = json_decode($_POST['json']); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 91k
  • Answers 91k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer use 'having' SELECT p.name, avg(r.rating) as average FROM products p… May 11, 2026 at 6:11 pm
  • Editorial Team
    Editorial Team added an answer The issue has been resolved as my error. The callbacks… May 11, 2026 at 6:11 pm
  • Editorial Team
    Editorial Team added an answer There are basically two ways of doing this: exceptions and… May 11, 2026 at 6:11 pm

Related Questions

Vista SP1 Visual Studio 2008 SP1 .NET 3.5 SP1 C# I have a winforms
I have a WinForms app that I deploy using ClickOnce. In the application project
I have 50+ kiosk style computers that I want to be able to get
I'm developing a WinForms application (.Net 3.5, no WPF) where I want to be

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.