On the server side of php, the client uses the android mobile phone for communication problems.

Source: Internet
Author: User
Tags abstract language
On the server side of php, the client sends a string of numbers to the server side using the android mobile phone. after the server side verifies, the return value is returned to the client, how does the server implement this function in the background?


Reply to discussion (solution)

You can use php to write an interface.

Verify and then output the returned content

You can use php to write an interface.

Verify and then output the returned content
Does php have the interface definition? Isn't an interface in an abstract language?

It is actually a php file.
The client requests this http address

It is actually a php file.
The client requests this http address
Okay, I see. try it.

Reference the reply from zhangbin1988 on the first floor: If you use php, write an interface.

Verify and then output the returned content
Does php have the interface definition? Isn't an interface in an abstract language?


The interface mentioned here is not the interface implementing polymorphism in oop. php also supports this interface.

The method mentioned above is to communicate through the http protocol, which is the simplest and easier. However, if packets are frequently sent, the efficiency is not as high as that of persistent connections. Php can also be used as a server process to listen to a port and maintain a persistent connection between the client and the server. You can find related extensions in the pecl Library.

Reference the reply from aa77a on the second floor: reference the reply from zhangbin1988 on the first floor: you can write an interface in php.

Verify and then output the returned content
Does php have the interface definition? Isn't an interface in an abstract language?


The interface mentioned here is not the interface implementing polymorphism in oop. php also supports this interface.

The method mentioned above is to communicate through the http protocol, which is the simplest and easier. However, if packets are sent frequently, the efficiency is not as high as that of persistent connections ......

How can we connect a mobile phone to a computer during the Angel process? The server is a PHP file and the client is an android application.

It is actually a php file.
The client requests this http address
How to debug it? That is, how to establish a connection between a mobile phone and a computer?

The server is listening to port 80 through apache or nginx, and the mobile phone interacts with the server through http request and response.

The server is listening to port 80 through apache or nginx, and the mobile phone interacts with the server through http request and response.
How to determine the url? I wrote "http: // 10.0.2.2/test/communicate. php", and put the php file in the test folder under the same directory. how can I determine the ip address at the front?

Reference the reply from zhangbin1988 on the third floor: it is actually a php file.
The client requests this http address
How to debug it? That is, how to establish a connection between a mobile phone and a computer?

After the php file is written
The mobile client simulates the post or get request to obtain the returned content from the http address.

Reference the reply from aa77a on the 7th floor: reference the reply from zhangbin1988 on the 3rd floor: Actually, it is a PHP file.
The client requests this http address
How to debug it? That is, how to establish a connection between a mobile phone and a computer?

After the php file is written
The mobile client simulates the post or get request to obtain the returned content from the http address.
How does php receive json data sent by android?

The server is listening to port 80 through apache or nginx, and the mobile phone interacts with the server through http request and response.
How does php receive json data?

Reference the reply from zhangbin1988 on the 10th floor: reference the reply from aa77a on the 7th floor: reference the reply from zhangbin1988 on the 3rd floor: Actually, it is a PHP file.
The client requests this http address
How to debug it? That is, how to establish a connection between a mobile phone and a computer?

After the php file is written
The mobile client simulates the post or get request to obtain the returned content from the http address.
How to receive jso sent by android in php ......

The transmitted data is in json format.
Submit or use post or get

Example:
GET request interface
Api. php? JsonValue = {"name": "ayzen", "age": "25 "}

Your php will handle it.
$ Array = json_decode ($ _ GET ['jsonvalue']);

Good stuff. share it!

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.