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

  • SEARCH
  • Home
  • 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 6236867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:55:21+00:00 2026-05-24T10:55:21+00:00

In my project I suppose to write a desktop app that sends an xml

  • 0

In my project I suppose to write a desktop app that sends an xml document as file or as string,
to a php script on server that need to parse it.
Right now, I have php script that parse the xml, and have the xml ready at the desktop app.
My questions are:
a. which way is better: to send the document as file, or as string?
b. How to implement the request (file or string) by C#, and the acception of the document by php.

Notes:
a. I can use only C# at the desktop application.
b. I can use only php script on the server.
c. I use System.xml.linq to handle the xml document at the desktop app.

Thanks a lot!

  • 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. Editorial Team
    Editorial Team
    2026-05-24T10:55:22+00:00Added an answer on May 24, 2026 at 10:55 am

    This can be as simple or as complex as you like 😉
    Here’s a very simple, basic example (without error handling et al):

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;
    using System.Net;
    
    namespace LinqXMLTest
    {
        class Program
        {
            static void Main(string[] args)
            {
                Object[] res = { "Stackoverflow", true, 'x', 42};
                XElement xml = new XElement("Foo",
                    from a in res select
                        new XElement("bar",
                            new XElement("type", a.GetType()),
                            new XElement("value", a.ToString())
                        )
                );
    
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost/test.php");
                request.Method = "POST";
                xml.Save( request.GetRequestStream() );
                HttpWebResponse resp = request.GetResponse() as HttpWebResponse;
            }
        }
    }
    

    and as “receiver”:

    <?php
    $fp = fopen('php://input', 'rb');
    file_put_contents('test.dat', $fp);
    

    afterwards the file test.dat on the server contains

    <?xml version="1.0" encoding="utf-8"?>
    <Foo>
      <bar>
        <type>System.String</type>
        <value>Stackoverflow</value>
      </bar>
      <bar>
        <type>System.Boolean</type>
        <value>True</value>
      </bar>
      <bar>
        <type>System.Char</type>
        <value>x</value>
      </bar>
      <bar>
        <type>System.Int32</type>
        <value>42</value>
      </bar>
    </Foo>
    

    see also:
    XElement.Save Method (Stream)
    WebRequest.GetRequestStream Method
    http://docs.php.net/wrappers.php.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose my solution have two project: myApp: silverlight application project: the default application App
Suppose, I have an opensource project that depends on some library, that must be
Let us suppose we are going to start new project - application that contains
Having been googling for hours, I realize that users can use either xml file(orm.xml,
I need to write my next project using ExtJs. It's a nice Javascript lib
We are suppose to write a calendar for a project. I'm using an array
For a project I have a series of pseudo-repositories that create XML (they aren't
I have an Android Library Project that contains several styles/themes defined in its styles.xml
Suppose I'd like to edit an Open Source project that's written in vs2005, and
Suppose you're working on an enterprise project in which you have to get management

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.