How does the. net background post data (json) to the PHP server across domains)

Source: Internet
Author: User
Tags php server
@ Big gray wolf: HttpWebRequestrequest (HttpWebRequest) WebRequest. Create (url); request. MethodPOST; then set other http headers to get header information such as contenttype through packet capture. YourClassobjnewYourClass (); serialize your YourClass to json format Json

@ Wolf: HttpWebRequest request = (HttpWebRequest) WebRequest. create (url); request. method = "POST"; // set other http headers. You can capture the contenttype and other header information. YourClass obj = new YourClass (); // serialize your YourClass to json format Json

@ WOLF:

HttpWebRequest request = (HttpWebRequest) WebRequest. Create (url );

Request. Method = "POST ";

// Set other http headers. You can capture the contenttype and other header information by capturing packets.

YourClass obj = new YourClass ();

// Serialize your YourClass to json format

JsonSerializer formater = new JsonSerializer ();

Formater. Serialize (MS, obj );

// Get the Stream through request. GetRequestStream (), and then Write the serialized content to the request through Stream. Write.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.