Does php receive json data sent by android? Android json php
$ Response = array ();
Include ("conn. php ");
$ Conn = mysql_open ();
$ SQL = mysql_query ('set names utf8 ');
Mysql_query ($ SQL );
If (isset ($ _ POST ['name']) {...... Why does the system prompt an undefined name? The name is sent by android.
Reply to discussion (solution)
Aren't you using json? What is the content you sent? How do you know this? what is the error message? Just a prompt.
Aren't you using json? What is the content you sent? How do you know this? what is the error message? This is a prompt. thank you for your prompt. Android end
Params. add (new BasicNameValuePair ("name", name ));
JSONObject json = jsonParser. makeHttpRequest (url_up, "POST", params); sent in post mode
Why can't we get data from $ _ POST ['name'] on the php end? When debugging, I first run the android program, and then open the browser, showing that no data was received, and data was not inserted in the database.
Reply by referencing PhpNewnew on the first floor: are you not in json format? What is the content you sent? How do you know this? what is the error message? This is a prompt. thank you for your prompt. Android end
Params. add (new BasicNameValuePair ("name", name ));
JSONObject json = jsonParser. makeHttpRequest (url_u ......
Check whether the name is obtained. you can save the value to the file. Because the Android program calls your php file as soon as it is opened, and you open the file again, it must have been copied.
Run the android program first, and then open the browser.
???
Can this happen?
Reference the reply from aa77a on the second floor: reference the reply from PhpNewnew on the first floor: are you not in json format? What is the content you sent? How do you know this? what is the error message? This is a prompt. thank you for your prompt. Android end
Params. add (new BasicNameValuePair ("name", name ));
JSONObject json = jsonParser. make ......
It turns out that my android program is wrong, and the IP address in the url is wrong. But it is also strange that I saw a temporary Lan in my laptop, and then my mobile phone was connected to the network, so I wrote the IP address of the network, however, it turns out that you need to write the IP address of the network connected to the computer.
$ Data = file_get_contents ("php: // input"); to receive data, because PHP recognizes only the application/x-www.form-urlencoded standard data type by default, the text, xml, soap, and application/octet-stream types cannot be parsed.