Php serves as the server to accept data. This post was last edited by chaoyangqq from 2014-03-at the bottom layer. what teammates do is to read only the data in the http message data, how should I communicate with him! I tried to use curl to read data but it was unsuccessful. curl_setopt ($ ch, & nbsp; CURLOPT_URL, 19 php was used to receive data on the server.
This post was last edited by chaoyangqq at 08:40:28
What the bottom layer does not understand is that teammates only want to read the data in the http packet data. how should I communicate with him! I tried to use curl to read but failed.
Curl_setopt ($ ch, CURLOPT_URL, "192.168.16.254: 8080 ");
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
// Save it to a string or output it to the screen, 1 hidden
Curl_setopt ($ ch, CURLOPT_TIMEOUT, 1); // obtain the information of up to one second
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Echo $ output = curl_exec ($ ch );
Curl_close ($ ch );
For guidance.
------ Solution --------------------
The php server that receives client data can be obtained through $ _ POST, $ _ GET, $ _ REQUEST. The client needs to use the corresponding $ _ post and $ _ get to submit data. $ _ REQUEST seems to be okay.
As for the difference between $ _ POST and $ _ GET, you can find too many items on Baidu.
$ _ POST, $ _ GET returns the parameters passed by your client. you can process these parameters to complete the function. to return data to the client, you only need echo.
I am working on a php server Recently. I don't know why. I cannot GET data using $ _ POST, $ _ GET, $ _ REQUEST. So I found $ GLOBALS [$ HTTP_RAW_POST_DATA] and file_get_contents ("http: // input") to get the data.
Both of the above methods can obtain the first type of data in the post request from the client.
I used the second $ request = file_get_contents ("http: // input") to get the post parameters from the client.
I only need to work on the php server temporarily. I don't know much about it because I haven't learned through the system. I just got the php server ready. Hope to help you.
------ Solution --------------------
Echo $ output = curl_exec ($ ch); no data?
Possible causes
1.192.168.16.254: 8080 this page has no output.
2. curl connection error. you can add curl_error to view the error.
if(curl_errno($ch)){
echo 'curl error:'.curl_error($ch);
}