is it possible to get values from a asp.net to a php script?

Recommended Answers

All 4 Replies

Convert your data to XML and send it to PHP.

Convert your data to XML and send it to PHP.

how? can you give a sample source code please?...

I don't know the side of PHP but there should be enough classes to work with XML.
In this example I created a simple class called Person. This class will be serialized to an XML file called Person.xml. Most .NET objects are serializable so you can serialize almost any object, think of DataTable, DataSet etc.

Though serialization is a huge topic, here is a simple sample that can easily be modified to serialize many types of objects.

If you need your own custom class to be serialized, first create the class and mark it as Serializable:

[Serializable()]
public class Person
{
    public string FirstName;
    public string LastName;

    public Person() { }

}

Because you are writing to disk and you are going to use Xml serialization, include the following namespaces.

using System.IO;
using System.Xml.Serialization;

The following code creates the person class, then uses the filestream to create a file. Next it serializes the object and passes it to the filestream that writes the data to disk.

Person p = new Person();
p.FirstName = "Jim";
p.LastName = "Jones";
        
FileStream fs = new FileStream(@"c:\MyFolder\Person.xml", FileMode.Create);
XmlSerializer xs = new XmlSerializer(typeof(Person));
xs.Serialize(fs, p);
fs.Close();

Then you need to find the PHP code to read from it. Again (Xml)serialization is a big topic and you can customize the xml output completely. For more I information about (Xml)serializing I suggest you do some Online searching on this topic.

I hope this was helpfull

Thank you very much for your kind reply...
Thank very much for the sample you gave.. it helps a lot

Now I have a clue where to start studying

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.