About the value transfer mechanism between java and php using json!

Source: Internet
Author: User
About the value transfer mechanism between java and php using json! I have encountered such a problem:

First, I can implement the following steps: The java program sends a request to my php page. I use json_encode to return the data to the java program.

Now, I don't know how to implement the following steps. I don't know how to implement the mechanism in it ?!!!

That is, the java program sends a json data packet to my php page. what function should I use in php or use a custom method to obtain the json data packet sent by the java program? Can I use the request line?

As long as I know how to obtain it, I know how to interpret its json data packets ~~

Master ~~ Thank you ~

I don't have a lot of small scores, so I can try to give it so much ~~


Reply to discussion (solution)

In java, you can't directly post and get the past, right? What functions are used?

Ajax.

In java, you can't directly post and get the past, right? What functions are used?

On the java program side, I post the php page to me. I have used $ _ POST for receiving and no data output. as for $ _ GET, it is useless, because it is not passed through the url. So I don't know how to get the data from the java program.

Ajax.
Can you give an example?

If you use java post, php does not have any data, that is, no POST is successful. check the data to see what went wrong.

Ajax also uses post or get.

I have encountered such a problem:

First, I can implement the following steps: The java program sends a request to my php page. I use json_encode to return the data to the java program.

Now, I don't know how to implement the following steps. I don't know how to implement the mechanism in it ?!!!

That is, the java program sends a json data packet to my php page. what function should I use in php or use a custom method to obtain the json data packet sent by the java program? Use re ......

Json_encode and json_decode of PHP cannot interwork with JAVA. we recommend that you use strings for transmission so that PHP and JAVA can handle them correctly.

File_get_contents ("php: // input") pushes data in java. in this way, the php client can get the data.

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.